Skip to content

Commit

Permalink
sapB, sapG formats: Fix out-of-bounds access bug in scalar build
Browse files Browse the repository at this point in the history
  • Loading branch information
solardiz committed Jan 5, 2024
1 parent 0cc2587 commit 9c027ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/sapB_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ static int crypt_all(int *pcount, struct db_salt *salt)
keyLen[t] = strlen(saved_plain[t]);

// Back-out of trailing spaces
while ( saved_plain[t][keyLen[t] - 1] == ' ' )
while ( keyLen[t] && saved_plain[t][keyLen[t] - 1] == ' ' )
{
if (keyLen[t] == 0) break;
saved_plain[t][--keyLen[t]] = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/sapG_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ static int crypt_all(int *pcount, struct db_salt *salt)
keyLen[index] = strlen((char*)saved_key[index]);

// Back-out of trailing spaces
while (saved_key[index][keyLen[index] - 1] == ' ') {
while (keyLen[index] && saved_key[index][keyLen[index] - 1] == ' ') {
saved_key[index][--keyLen[index]] = 0;
if (keyLen[index] == 0) break;
}
Expand Down

0 comments on commit 9c027ef

Please sign in to comment.