Fix potential access of null pointer (pp)
authorRob Percival <robpercival@google.com>
Tue, 7 Jun 2016 16:01:44 +0000 (17:01 +0100)
committerRich Salz <rsalz@openssl.org>
Tue, 7 Jun 2016 16:21:46 +0000 (12:21 -0400)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1186)

crypto/ct/ct_oct.c

index ced585f..cacc3bd 100644 (file)
@@ -365,9 +365,9 @@ int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp)
     if (pp != NULL) {
         p = *pp;
         s2n(len2 - 2, p);
+        if (!is_pp_new)
+            *pp += len2;
     }
-    if (!is_pp_new)
-        *pp += len2;
     return len2;
 
  err: