Skip to content

Bug in main.asm when a char is encrypted to '\0' (NULL char) #38

@MostafaSaad7

Description

@MostafaSaad7

BUG in main.asm

main.asm have a bug: When a char is encrypted to '\0', there is a problem happens when we copy teaOut to teaIn again for decryption because Str_copy copys characters till it finds a '\0' so the teaOut is not fully copied back to teaIn in this case.

Failed test case:
input: MACBETH. My dearest love, Duncan comes here tonight. LADY MACBETH. And when goes hence? MACBETH. Tomorrow, as he purposes. LADY MACBETH.
Enter Key 1: 7
Enter Key 2: 8
Enter Key 3: 9
Enter Key 4: 0

-------------------------------------------------------------------------------------------------------------------------

Program Output:

Encrypted: ╤;╘ûطQ▼s�<Rn╩n"ئnص²ظp├╕ٌّDû╨╗fo┴¤ئ├╖%"╪�►└3
┼→¤ ?<eء:ص#كِs√(z5ًB╬
VV-H4J≡}g �.cصطyٌë�ê╤;╘ûط
Q▼╧┬■Z ≡▼ⁿ╟�7ُئcS╙%╢/اْrف▐▄عu╔ô╜ë/╤;╘ûط~Q▼

Decrypted: MACBETH. My dearest love, Duncan comes here tonight. LADY MACBET∙↑┘'3îّTb↔️═┐Z)زx│«nlt«$→▀ْ5╥▒╩��♣️ى┐PT
UPr▬إ%
«رt►ج▼1ع~دس≡#\VP╫ب£▀ْ5╥▒╩��

-------------------------------------------------------------------------------------------------------------------------

Expected Output:

Encrypted: ╤;╘ûطQ▼s�<Rn╩n"ئnص²ظp├╕ٌّDû╨╗fo┴¤ئ├╖%"╪�►└3
┼→¤ ?<eء:ص#كِs√(z5ًB╬
V V-H4J≡}g �.cصطyٌë�ê╤;╘ûط
Q▼╧┬■Z ≡▼ⁿ╟�7ُئcS╙%╢/اْrف▐▄عu╔ô╜ë/╤;╘ûط~Q▼

Decrypted: MACBETH. My dearest love, Duncan comes here tonight. LADY MACBETH. And when goes hence? MACBETH. Tomorrow, as he purposes. LADY MACBETH.

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions