Bug fix for segmentation fault when using NULL pin. Unit test to come in later update.

This commit is contained in:
Sara Dickinson 2016-01-07 17:17:09 +00:00
parent fa1fa55110
commit f8b041cd40
1 changed files with 1 additions and 1 deletions

View File

@ -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') ||