summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbeck <>2015-12-12 21:05:11 +0000
committerbeck <>2015-12-12 21:05:11 +0000
commite6761699f79ff2c2ab346ed4e641f83964fe8f31 (patch)
tree5dc613683d6422525cd3028f129edba9007c6545
parentfa2eb18945d522f92d7dd030c7d055ef2a23411d (diff)
downloadopenbsd-e6761699f79ff2c2ab346ed4e641f83964fe8f31.tar.gz
openbsd-e6761699f79ff2c2ab346ed4e641f83964fe8f31.tar.bz2
openbsd-e6761699f79ff2c2ab346ed4e641f83964fe8f31.zip
move initialization of buf up to quell warnings and make it obvious the err case is ok.
ok bcook@
-rw-r--r--src/lib/libcrypto/asn1/tasn_dec.c9
-rw-r--r--src/lib/libssl/src/crypto/asn1/tasn_dec.c9
2 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c
index dd350070f7..23a6740115 100644
--- a/src/lib/libcrypto/asn1/tasn_dec.c
+++ b/src/lib/libcrypto/asn1/tasn_dec.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_dec.c,v 1.28 2015/12/04 04:19:25 beck Exp $ */ 1/* $OpenBSD: tasn_dec.c,v 1.29 2015/12/12 21:05:11 beck Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -676,6 +676,10 @@ asn1_d2i_ex_primitive(ASN1_VALUE **pval, const unsigned char **in, long inlen,
676 const unsigned char *cont = NULL; 676 const unsigned char *cont = NULL;
677 long len; 677 long len;
678 678
679 buf.length = 0;
680 buf.max = 0;
681 buf.data = NULL;
682
679 if (!pval) { 683 if (!pval) {
680 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_NULL); 684 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_NULL);
681 return 0; /* Should never happen */ 685 return 0; /* Should never happen */
@@ -753,9 +757,6 @@ asn1_d2i_ex_primitive(ASN1_VALUE **pval, const unsigned char **in, long inlen,
753 buf.data = NULL; 757 buf.data = NULL;
754 } 758 }
755 } else if (cst) { 759 } else if (cst) {
756 buf.length = 0;
757 buf.max = 0;
758 buf.data = NULL;
759 /* Should really check the internal tags are correct but 760 /* Should really check the internal tags are correct but
760 * some things may get this wrong. The relevant specs 761 * some things may get this wrong. The relevant specs
761 * say that constructed string types should be OCTET STRINGs 762 * say that constructed string types should be OCTET STRINGs
diff --git a/src/lib/libssl/src/crypto/asn1/tasn_dec.c b/src/lib/libssl/src/crypto/asn1/tasn_dec.c
index dd350070f7..23a6740115 100644
--- a/src/lib/libssl/src/crypto/asn1/tasn_dec.c
+++ b/src/lib/libssl/src/crypto/asn1/tasn_dec.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_dec.c,v 1.28 2015/12/04 04:19:25 beck Exp $ */ 1/* $OpenBSD: tasn_dec.c,v 1.29 2015/12/12 21:05:11 beck Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2000. 3 * project 2000.
4 */ 4 */
@@ -676,6 +676,10 @@ asn1_d2i_ex_primitive(ASN1_VALUE **pval, const unsigned char **in, long inlen,
676 const unsigned char *cont = NULL; 676 const unsigned char *cont = NULL;
677 long len; 677 long len;
678 678
679 buf.length = 0;
680 buf.max = 0;
681 buf.data = NULL;
682
679 if (!pval) { 683 if (!pval) {
680 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_NULL); 684 ASN1err(ASN1_F_ASN1_D2I_EX_PRIMITIVE, ASN1_R_ILLEGAL_NULL);
681 return 0; /* Should never happen */ 685 return 0; /* Should never happen */
@@ -753,9 +757,6 @@ asn1_d2i_ex_primitive(ASN1_VALUE **pval, const unsigned char **in, long inlen,
753 buf.data = NULL; 757 buf.data = NULL;
754 } 758 }
755 } else if (cst) { 759 } else if (cst) {
756 buf.length = 0;
757 buf.max = 0;
758 buf.data = NULL;
759 /* Should really check the internal tags are correct but 760 /* Should really check the internal tags are correct but
760 * some things may get this wrong. The relevant specs 761 * some things may get this wrong. The relevant specs
761 * say that constructed string types should be OCTET STRINGs 762 * say that constructed string types should be OCTET STRINGs