summaryrefslogtreecommitdiffstats
path: root/crypto/pem
diff options
context:
space:
mode:
authorTomas Mraz <tmraz@fedoraproject.org>2020-05-19 10:51:19 +0200
committerTomas Mraz <tmraz@fedoraproject.org>2020-05-20 17:57:22 +0200
commite11072908742e96a1067bb1b9609bfc27ab05835 (patch)
tree5ec83dd3d6ddee727a1328faa00056340a5f4e7f /crypto/pem
parent5f10fce37b234807c39d6b1b6440585b84b68b65 (diff)
Cast the unsigned char to unsigned int before shifting left
This is needed to avoid automatic promotion to signed int. Fixes #11853 [extended tests] Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11857) (cherry picked from commit cbeb0bfa961412eebfbdf1e72900f05527e81e15)
Diffstat (limited to 'crypto/pem')
-rw-r--r--crypto/pem/pvkfmt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c
index 46ed2ecdbc..e6156df533 100644
--- a/crypto/pem/pvkfmt.c
+++ b/crypto/pem/pvkfmt.c
@@ -29,10 +29,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;
}