fixed byte format overflowing

yippee
This commit is contained in:
Václav Šmejkal 2024-02-24 21:56:35 +01:00
parent 9734749c3e
commit 0abd38e877
Signed by: ENGO150
GPG Key ID: 4A57E86482968843
2 changed files with 2 additions and 14 deletions

View File

@ -81,13 +81,7 @@ why2_output_flags why2_decrypt_text(char *text, char *key_new)
for (unsigned short j = 2 + (i * 2); j <= 3 + (i * 2); j++) for (unsigned short j = 2 + (i * 2); j <= 3 + (i * 2); j++)
{ {
//ENSURE THERE IS NO \0 (REVERSED) //ENSURE THERE IS NO \0 (REVERSED)
if (text_copy[j] > 0) if (text_copy[j] == -128) text_copy[j] = 0;
{
text_copy[j]--;
} else
{
text_copy[j]++;
}
} }
//PUT TOGETHER //PUT TOGETHER

View File

@ -132,13 +132,7 @@ why2_output_flags why2_encrypt_text(char *text, char *key_new)
for (unsigned long j = 2 + (i * 2); j <= 3 + (i * 2); j++) for (unsigned long j = 2 + (i * 2); j <= 3 + (i * 2); j++)
{ {
//ENSURE THERE IS NO \0 //ENSURE THERE IS NO \0
if (returning_text[j] > 0) if (returning_text[j] == 0) returning_text[j] = -128;
{
returning_text[j]++;
} else
{
returning_text[j]--;
}
} }
} }
} }