]> Git Repo - secp256k1.git/commitdiff
Add ARG_CHECKs to secp256k1_ec_pubkey_parse/secp256k1_ec_pubkey_serialize
authorGregory Maxwell <[email protected]>
Sun, 27 Sep 2015 23:45:12 +0000 (23:45 +0000)
committerGregory Maxwell <[email protected]>
Tue, 13 Oct 2015 19:39:58 +0000 (19:39 +0000)
This also makes secp256k1_ec_pubkey_parse's init of pubkey more unconditional.

src/secp256k1.c

index 203f880af47c81a8acf3e8c8fae124db842a0675..8ef16ac9a78d5d0929a25337b91096158e4b0c12 100644 (file)
@@ -146,8 +146,11 @@ int secp256k1_ec_pubkey_parse(const secp256k1_context* ctx, secp256k1_pubkey* pu
     secp256k1_ge Q;
 
     (void)ctx;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(pubkey != NULL);
+    memset(pubkey, 0, sizeof(*pubkey));
+    ARG_CHECK(input != NULL);
     if (!secp256k1_eckey_pubkey_parse(&Q, input, inputlen)) {
-        memset(pubkey, 0, sizeof(*pubkey));
         return 0;
     }
     secp256k1_pubkey_save(pubkey, &Q);
@@ -159,6 +162,10 @@ int secp256k1_ec_pubkey_serialize(const secp256k1_context* ctx, unsigned char *o
     secp256k1_ge Q;
 
     (void)ctx;
+    VERIFY_CHECK(ctx != NULL);
+    ARG_CHECK(output != NULL);
+    ARG_CHECK(outputlen != NULL);
+    ARG_CHECK(pubkey != NULL);
     return (secp256k1_pubkey_load(ctx, &Q, pubkey) &&
             secp256k1_eckey_pubkey_serialize(&Q, output, outputlen, flags));
 }
This page took 0.028339 seconds and 4 git commands to generate.