From: md@Linux.IT Date: Mon, 24 Nov 2003 02:35:03 +0000 (-0800) Subject: [PATCH] fix segfault in parsing bad udev.permissions file X-Git-Tag: 007~11 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04a81cac0aab2ab6a54ddc661dd57be7d5b1595a;p=systemd [PATCH] fix segfault in parsing bad udev.permissions file --- diff --git a/namedev.c b/namedev.c index bed328f6..24b9bc01 100644 --- 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);