Skip to content

Commit

Permalink
Avoid null pointer dereference in md2_digest
Browse files Browse the repository at this point in the history
  • Loading branch information
vil02 authored and Legrandin committed Aug 18, 2024
1 parent 959c93a commit 38033a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/MD2.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ EXPORT_SYM int md2_digest(const hash_state *hs, uint8_t digest[16])
uint8_t padding[16];
unsigned padlen, i;
hash_state temp;

assert(hs->count < 16);

if (NULL==hs || digest==NULL)
return ERR_NULL;


assert(hs->count < 16);

temp = *hs;
padlen = 16 - hs->count; /** 1..16 **/
for(i=0; i<padlen; i++) {
Expand Down

0 comments on commit 38033a3

Please sign in to comment.