summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libcrypto/asn1/a_bitstr.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libcrypto/asn1/a_bitstr.c b/lib/libcrypto/asn1/a_bitstr.c
index 11771bdd026..7fd40d8a8c6 100644
--- a/lib/libcrypto/asn1/a_bitstr.c
+++ b/lib/libcrypto/asn1/a_bitstr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: a_bitstr.c,v 1.28 2018/05/13 13:48:08 jsing Exp $ */
+/* $OpenBSD: a_bitstr.c,v 1.29 2018/10/20 16:07:09 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -118,10 +118,11 @@ 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)
- p[-1]&=(0xff << bits);
+ if (len > 0) {
+ memcpy(p, d, len);
+ p += len;
+ p[-1] &= 0xff << bits;
+ }
*pp = p;
return (ret);
}