summaryrefslogtreecommitdiff
path: root/thirdparty/openssl/crypto/asn1/a_bitstr.c
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/openssl/crypto/asn1/a_bitstr.c')
-rw-r--r--thirdparty/openssl/crypto/asn1/a_bitstr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/thirdparty/openssl/crypto/asn1/a_bitstr.c b/thirdparty/openssl/crypto/asn1/a_bitstr.c
index f906188b11..c429342e03 100644
--- a/thirdparty/openssl/crypto/asn1/a_bitstr.c
+++ b/thirdparty/openssl/crypto/asn1/a_bitstr.c
@@ -114,10 +114,11 @@ int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp)
*(p++) = (unsigned char)bits;
d = a->data;
- memcpy(p, d, len);
- p += len;
- if (len > 0)
+ if (len > 0) {
+ memcpy(p, d, len);
+ p += len;
p[-1] &= (0xff << bits);
+ }
*pp = p;
return (ret);
}