diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/asn1/a_bitstr.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c index 11771bdd02..7fd40d8a8c 100644 --- a/src/lib/libcrypto/asn1/a_bitstr.c +++ b/src/lib/libcrypto/asn1/a_bitstr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_bitstr.c,v 1.28 2018/05/13 13:48:08 jsing Exp $ */ | 1 | /* $OpenBSD: a_bitstr.c,v 1.29 2018/10/20 16:07:09 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -118,10 +118,11 @@ i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) | |||
118 | 118 | ||
119 | *(p++) = (unsigned char)bits; | 119 | *(p++) = (unsigned char)bits; |
120 | d = a->data; | 120 | d = a->data; |
121 | memcpy(p, d, len); | 121 | if (len > 0) { |
122 | p += len; | 122 | memcpy(p, d, len); |
123 | if (len > 0) | 123 | p += len; |
124 | p[-1]&=(0xff << bits); | 124 | p[-1] &= 0xff << bits; |
125 | } | ||
125 | *pp = p; | 126 | *pp = p; |
126 | return (ret); | 127 | return (ret); |
127 | } | 128 | } |