From f8b041cd406a720710429a55925bde875370ea99 Mon Sep 17 00:00:00 2001 From: Sara Dickinson Date: Thu, 7 Jan 2016 17:17:09 +0000 Subject: [PATCH] Bug fix for segmentation fault when using NULL pin. Unit test to come in later update. --- src/pubkey-pinning.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pubkey-pinning.c b/src/pubkey-pinning.c index 2f685ad3..6e7cdf39 100644 --- a/src/pubkey-pinning.c +++ b/src/pubkey-pinning.c @@ -99,7 +99,7 @@ getdns_dict* getdns_pubkey_pin_create_from_string( getdns_dict* out = NULL; /* we only do sha256 right now, make sure this is well-formed */ - if (strncmp(PIN_PREFIX, str, PIN_PREFIX_LENGTH)) + if (!str || strncmp(PIN_PREFIX, str, PIN_PREFIX_LENGTH)) return NULL; for (i = PIN_PREFIX_LENGTH; i < PIN_PREFIX_LENGTH + B64_ENCODED_SHA256_LENGTH - 1; i++) if (!((str[i] >= 'a' && str[i] <= 'z') ||