Only cleanse sbuf if it is not NULL.
authorDr. Stephen Henson <steve@openssl.org>
Sat, 5 Jul 2014 21:32:39 +0000 (22:32 +0100)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 5 Jul 2014 21:32:39 +0000 (22:32 +0100)
PR#2339

fips/rsa/fips_rsa_sign.c

index a4e03e7417fea7c0d92226196febfbfc8ed9067a..4956971f04d98acfdee43cb9dd4b70f727db4e45 100644 (file)
@@ -288,8 +288,11 @@ int FIPS_rsa_sign_digest(RSA *rsa, const unsigned char *md, int md_len,
                        *siglen=j;
                        }
                psserr:
-               OPENSSL_cleanse(sbuf, i);
-               OPENSSL_free(sbuf);
+               if (sbuf)
+                       {
+                       OPENSSL_cleanse(sbuf, i);
+                       OPENSSL_free(sbuf);
+                       }
                return ret;
                }