poldek: poldek/conf.c - fixed SIGSEV while parsing empty config va...

mis mis at pld-linux.org
Sat Mar 18 16:27:52 CET 2006


Author: mis                          Date: Sat Mar 18 15:27:52 2006 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- fixed SIGSEV while parsing empty config values (#5742)

---- Files affected:
poldek/poldek:
   conf.c (1.79 -> 1.80) 

---- Diffs:

================================================================
Index: poldek/poldek/conf.c
diff -u poldek/poldek/conf.c:1.79 poldek/poldek/conf.c:1.80
--- poldek/poldek/conf.c:1.79	Sat Nov  5 18:47:55 2005
+++ poldek/poldek/conf.c	Sat Mar 18 16:27:47 2006
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2000 - 2005 Pawel A. Gajda <mis at k2.net.pl>
+  Copyright (C) 2000 - 2006 Pawel A. Gajda <mis at k2.net.pl>
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License, version 2 as
@@ -137,9 +137,15 @@
         sep = " \t,";
     
     p = v = n_str_tokl(vstr, sep);
-    if (v == NULL)
+
+    if (v == NULL)              /* n_str_tokl error */
         return 0;
 
+    if (*v == NULL) {             /* empty option value */
+        n_str_tokl_free(v);
+        return 1;
+    }
+
     if (n_hash_exists(ht, name)) {
         opt = n_hash_get(ht, name);
         
@@ -166,6 +172,7 @@
         }
         p++;
     }
+
     n_str_tokl_free(v);
     return 1;
 }
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/poldek/poldek/conf.c?r1=1.79&r2=1.80&f=u



More information about the pld-cvs-commit mailing list