summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--namedev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/namedev.c b/namedev.c
index e86f88f433..c8217024c8 100644
--- a/namedev.c
+++ b/namedev.c
@@ -433,9 +433,9 @@ static int execute_program(char *path, char *value, int len)
/* don't separate if in apostrophes */
pos++;
argv[i] = strsep(&pos, "\'");
- while (pos[0] == ' ')
+ while (pos && pos[0] == ' ')
pos++;
- } else {
+ } else {
argv[i] = strsep(&pos, " ");
}
dbg("arg[%i] '%s'", i, argv[i]);