chiark / gitweb /
[PATCH] more config file parsing robustness
authorazarah@nosferatu.za.org <azarah@nosferatu.za.org>
Tue, 25 Nov 2003 07:25:06 +0000 (23:25 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:13:04 +0000 (21:13 -0700)
udev kept on segfaulting when it was in use, and not having the time
(and building it with DEBUG=true showing nothing), I have not tracked it
until tonight.  Seems like I made a type-o, and forgotten the ':'
between one line's group and permission parameters.  Attached patch
should stop the segfault, and warn at that at least.

namedev.c

index 83852f9df29abc52e9cac65140f353b750881b0a..391da7efcacc59f053a1e5f737efefe2d03e74ad 100644 (file)
--- a/namedev.c
+++ b/namedev.c
@@ -464,6 +464,10 @@ static int namedev_init_permissions(void)
                }
                strncpy(dev.group, temp2, sizeof(dev.owner));
 
                }
                strncpy(dev.group, temp2, sizeof(dev.owner));
 
+               if (!temp) {
+                       dbg("cannot parse line: %s", line);
+                       continue;
+               }
                dev.mode = strtol(temp, NULL, 8);
 
                dbg_parse("name='%s', owner='%s', group='%s', mode=%#o",
                dev.mode = strtol(temp, NULL, 8);
 
                dbg_parse("name='%s', owner='%s', group='%s', mode=%#o",