Skip to content

Commit

Permalink
Cast the unsigned char to unsigned int before shifting left
Browse files Browse the repository at this point in the history
This is needed to avoid automatic promotion to signed int.

Fixes #11853

[extended tests]
  • Loading branch information
t8m committed May 19, 2020
1 parent d9321c0 commit 32cf890
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crypto/pem/pvkfmt.c
Expand Up @@ -36,10 +36,10 @@ static unsigned int read_ledword(const unsigned char **in)
{
const unsigned char *p = *in;
unsigned int ret;
ret = *p++;
ret |= (*p++ << 8);
ret |= (*p++ << 16);
ret |= (*p++ << 24);
ret = (unsigned int)*p++;
ret |= (unsigned int)*p++ << 8;
ret |= (unsigned int)*p++ << 16;
ret |= (unsigned int)*p++ << 24;
*in = p;
return ret;
}
Expand Down

0 comments on commit 32cf890

Please sign in to comment.