From: Kay Sievers Date: Thu, 16 Oct 2008 19:35:11 +0000 (+0200) Subject: run_program: prevent empty last argv entry X-Git-Tag: 174~1437 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c28c4486af3fd970aef599be65e9c2d424765329;p=elogind.git run_program: prevent empty last argv entry --- diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 8b94d40c0..0bad2171f 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -138,9 +138,9 @@ static int run_program(struct udev_device *dev, const char *command, if (strchr(arg, ' ') != NULL) { char *pos = arg; - while (pos != NULL) { + while (pos != NULL && pos[0] != '\0') { if (pos[0] == '\'') { - /* don't separate if in apostrophes */ + /* do not separate quotes */ pos++; argv[i] = strsep(&pos, "\'"); while (pos != NULL && pos[0] == ' ')