Ensure that NULL r and s parameters cannot be set on DSA_SIG/ECDSA_SIGs.
[openssl.git] / crypto / dsa / dsa_asn1.c
index f2818f3ab6c36b7318d6bfc9607beaf5cc4e672f..f79e1d1404a5ce811abefe3c9b82731bc20bd2f6 100644 (file)
@@ -34,6 +34,8 @@ void DSA_SIG_get0(BIGNUM **pr, BIGNUM **ps, const DSA_SIG *sig)
 
 int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s)
 {
+    if (r == NULL || s == NULL)
+        return 0;
     BN_clear_free(sig->r);
     BN_clear_free(sig->s);
     sig->r = r;