Fix segfault with empty fields as last in the config.

Reviewed-by: Tim Hudson <tjh@openssl.org>
This commit is contained in:
Kurt Roeckx 2015-01-24 14:46:50 +01:00
parent c963c421fb
commit 2747d73c14
4 changed files with 13 additions and 0 deletions

View file

@ -279,6 +279,9 @@ static int asn1_cb(const char *elem, int len, void *bitstr)
int tmp_tag, tmp_class;
if (elem == NULL)
return 0;
for (i = 0, p = elem; i < len; p++, i++) {
/* Look for the ':' in name value pairs */
if (*p == ':') {
@ -805,6 +808,8 @@ static int mask_cb(const char *elem, int len, void *arg)
{
unsigned long *pmask = arg, tmpmask;
int tag;
if (elem == NULL)
return 0;
if (len == 3 && !strncmp(elem, "DIR", 3)) {
*pmask |= B_ASN1_DIRECTORYSTRING;
return 1;

View file

@ -103,6 +103,8 @@ int ENGINE_set_default(ENGINE *e, unsigned int flags)
static int int_def_cb(const char *alg, int len, void *arg)
{
unsigned int *pflags = arg;
if (alg == NULL)
return 0;
if (!strncmp(alg, "ALL", len))
*pflags |= ENGINE_METHOD_ALL;
else if (!strncmp(alg, "RSA", len))

View file

@ -167,6 +167,8 @@ static int ssl_set_option_list(const char *elem, int len, void *usr)
* len == -1 indicates not being called in list context, just for single
* command line switches, so don't allow +, -.
*/
if (elem == NULL)
return 0;
if (len != -1) {
if (*elem == '+') {
elem++;

View file

@ -596,6 +596,8 @@ static int nid_cb(const char *elem, int len, void *arg)
size_t i;
int nid;
char etmp[20];
if (elem == NULL)
return 0;
if (narg->nidcnt == MAX_CURVELIST)
return 0;
if (len > (int)(sizeof(etmp) - 1))
@ -4001,6 +4003,8 @@ static int sig_cb(const char *elem, int len, void *arg)
size_t i;
char etmp[20], *p;
int sig_alg, hash_alg;
if (elem == NULL)
return 0;
if (sarg->sigalgcnt == MAX_SIGALGLEN)
return 0;
if (len > (int)(sizeof(etmp) - 1))