aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/asn1/a_utf8.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2000-06-05 13:50:57 +0000
committerBodo Möller <bodo@openssl.org>2000-06-05 13:50:57 +0000
commit849c0e3046966cf3f0b2d51d5b4c7f3aee99424e (patch)
tree51048696b7ce460667bfd9bee122d9745baada4f /crypto/asn1/a_utf8.c
parentb368eddd04c8c1b961edde52f5a5dbf7ad7bdce5 (diff)
downloadopenssl-849c0e3046966cf3f0b2d51d5b4c7f3aee99424e.tar.gz
int may be smaller than 32 bits.
Diffstat (limited to 'crypto/asn1/a_utf8.c')
-rw-r--r--crypto/asn1/a_utf8.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/crypto/asn1/a_utf8.c b/crypto/asn1/a_utf8.c
index b5125af224..854278f136 100644
--- a/crypto/asn1/a_utf8.c
+++ b/crypto/asn1/a_utf8.c
@@ -133,7 +133,7 @@ int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
if( ((p[1] & 0xc0) != 0x80)
|| ((p[2] & 0xc0) != 0x80)
|| ((p[3] & 0xc0) != 0x80) ) return -3;
- value = (*p++ & 0x7) << 18;
+ value = ((unsigned long)(*p++ & 0x7)) << 18;
value |= (*p++ & 0x3f) << 12;
value |= (*p++ & 0x3f) << 6;
value |= *p++ & 0x3f;
@@ -145,9 +145,9 @@ int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
|| ((p[2] & 0xc0) != 0x80)
|| ((p[3] & 0xc0) != 0x80)
|| ((p[4] & 0xc0) != 0x80) ) return -3;
- value = (*p++ & 0x3) << 24;
- value |= (*p++ & 0x3f) << 18;
- value |= (*p++ & 0x3f) << 12;
+ value = ((unsigned long)(*p++ & 0x3)) << 24;
+ value |= ((unsigned long)(*p++ & 0x3f)) << 18;
+ value |= ((unsigned long)(*p++ & 0x3f)) << 12;
value |= (*p++ & 0x3f) << 6;
value |= *p++ & 0x3f;
if(value < 0x200000) return -4;
@@ -159,10 +159,10 @@ int UTF8_getc(const unsigned char *str, int len, unsigned long *val)
|| ((p[3] & 0xc0) != 0x80)
|| ((p[4] & 0xc0) != 0x80)
|| ((p[5] & 0xc0) != 0x80) ) return -3;
- value = (*p++ & 0x1) << 30;
- value |= (*p++ & 0x3f) << 24;
- value |= (*p++ & 0x3f) << 18;
- value |= (*p++ & 0x3f) << 12;
+ value = ((unsigned long)(*p++ & 0x1)) << 30;
+ value |= ((unsigned long)(*p++ & 0x3f)) << 24;
+ value |= ((unsigned long)(*p++ & 0x3f)) << 18;
+ value |= ((unsigned long)(*p++ & 0x3f)) << 12;
value |= (*p++ & 0x3f) << 6;
value |= *p++ & 0x3f;
if(value < 0x4000000) return -4;