Don't die if the value is NULL (Coverity CID 98).
authorBen Laurie <ben@openssl.org>
Sun, 1 Apr 2007 18:00:52 +0000 (18:00 +0000)
committerBen Laurie <ben@openssl.org>
Sun, 1 Apr 2007 18:00:52 +0000 (18:00 +0000)
crypto/conf/conf.h
crypto/conf/conf_err.c
crypto/conf/conf_mod.c

index 39f21b69f2dac4f9c68c8abe4866d79b67bb151e..9909374e84afc0cdd8f97ff3eb2cbf5cde7e0500 100644 (file)
@@ -214,6 +214,7 @@ void ERR_load_CONF_strings(void);
 #define CONF_F_CONF_LOAD_BIO                            102
 #define CONF_F_CONF_LOAD_FP                             103
 #define CONF_F_CONF_MODULES_LOAD                        116
+#define CONF_F_CONF_PARSE_LIST                          119
 #define CONF_F_DEF_LOAD                                         120
 #define CONF_F_DEF_LOAD_BIO                             121
 #define CONF_F_MODULE_INIT                              115
@@ -233,6 +234,7 @@ void ERR_load_CONF_strings(void);
 
 /* Reason codes. */
 #define CONF_R_ERROR_LOADING_DSO                        110
+#define CONF_R_LIST_CANNOT_BE_NULL                      115
 #define CONF_R_MISSING_CLOSE_SQUARE_BRACKET             100
 #define CONF_R_MISSING_EQUAL_SIGN                       101
 #define CONF_R_MISSING_FINISH_FUNCTION                  111
index bc378a7704a133db7596dc1e8345b9ef0630804b..25bb5dc9aa3639e508c6d05a81dc31ef916a0f35 100644 (file)
@@ -1,6 +1,6 @@
 /* crypto/conf/conf_err.c */
 /* ====================================================================
- * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -75,6 +75,7 @@ static ERR_STRING_DATA CONF_str_functs[]=
 {ERR_FUNC(CONF_F_CONF_LOAD_BIO),       "CONF_load_bio"},
 {ERR_FUNC(CONF_F_CONF_LOAD_FP),        "CONF_load_fp"},
 {ERR_FUNC(CONF_F_CONF_MODULES_LOAD),   "CONF_modules_load"},
+{ERR_FUNC(CONF_F_CONF_PARSE_LIST),     "CONF_parse_list"},
 {ERR_FUNC(CONF_F_DEF_LOAD),    "DEF_LOAD"},
 {ERR_FUNC(CONF_F_DEF_LOAD_BIO),        "DEF_LOAD_BIO"},
 {ERR_FUNC(CONF_F_MODULE_INIT), "MODULE_INIT"},
@@ -97,6 +98,7 @@ static ERR_STRING_DATA CONF_str_functs[]=
 static ERR_STRING_DATA CONF_str_reasons[]=
        {
 {ERR_REASON(CONF_R_ERROR_LOADING_DSO)    ,"error loading dso"},
+{ERR_REASON(CONF_R_LIST_CANNOT_BE_NULL)  ,"list cannot be null"},
 {ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET),"missing close square bracket"},
 {ERR_REASON(CONF_R_MISSING_EQUAL_SIGN)   ,"missing equal sign"},
 {ERR_REASON(CONF_R_MISSING_FINISH_FUNCTION),"missing finish function"},
index 587211a59c19b3533c78766f6e8589f66cf66553..7c9b42f7678e76fa97447380f61c7bdf96a814b2 100644 (file)
@@ -581,8 +581,14 @@ int CONF_parse_list(const char *list_, int sep, int nospc,
        {
        int ret;
        const char *lstart, *tmpend, *p;
-       lstart = list_;
 
+       if(list_ == NULL)
+               {
+               CONFerr(CONF_F_CONF_PARSE_LIST, CONF_R_LIST_CANNOT_BE_NULL);
+               return 0;
+               }
+
+       lstart = list_;
        for(;;)
                {
                if (nospc)