json: Add guard in create_keylist_patterns

* src/gpgme-json.c (create_keylist_patterns): Guard against
a string ending with a linbreak.
This commit is contained in:
Andre Heinecke 2018-05-25 14:50:20 +02:00
parent 1ff16dad59
commit 10683b1a91
No known key found for this signature in database
GPG Key ID: 2978E9D40CBABA5C

View File

@ -691,7 +691,7 @@ create_keylist_patterns (cjson_t request)
tmp = p + 1;
}
/* The last key is not newline delimted. */
ret[i++] = xstrdup (tmp);
ret[i++] = *tmp ? xstrdup (tmp) : NULL;
ret[i] = NULL;
xfree (keystring);