chiark / gitweb /
[PATCH] fix segfault in parsing bad udev.permissions file
authormd@Linux.IT <md@Linux.IT>
Mon, 24 Nov 2003 02:35:03 +0000 (18:35 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:13:02 +0000 (21:13 -0700)
namedev.c

index bed328f..24b9bc0 100644 (file)
--- a/namedev.c
+++ b/namedev.c
@@ -439,12 +439,24 @@ static int namedev_init_permissions(void)
 
                /* parse the line */
                temp2 = strsep(&temp, ":");
+               if (!temp2) {
+                       dbg("cannot parse line: %s", line);
+                       continue;
+               }
                strncpy(dev.name, temp2, sizeof(dev.name));
 
                temp2 = strsep(&temp, ":");
+               if (!temp2) {
+                       dbg("cannot parse line: %s", line);
+                       continue;
+               }
                strncpy(dev.owner, temp2, sizeof(dev.owner));
 
                temp2 = strsep(&temp, ":");
+               if (!temp2) {
+                       dbg("cannot parse line: %s", line);
+                       continue;
+               }
                strncpy(dev.group, temp2, sizeof(dev.owner));
 
                dev.mode = strtol(temp, NULL, 8);