summaryrefslogtreecommitdiff
path: root/ipif/service.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipif/service.c')
-rw-r--r--ipif/service.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/ipif/service.c b/ipif/service.c
index b401a5c..7821a46 100644
--- a/ipif/service.c
+++ b/ipif/service.c
@@ -329,13 +329,17 @@ static char *eat_optionalstr(const char **argp,
const char *def) {
ptrdiff_t len;
const char *start= *argp;
- const char *comma= strchr(start, ',');
- if (comma) {
- len= comma - start;
- *argp= comma + 1;
+ if (!start) {
+ len = 0;
} else {
- len= strlen(start);
- *argp= start + len;
+ const char *comma= strchr(start, ',');
+ if (comma) {
+ len= comma - start;
+ *argp= comma + 1;
+ } else {
+ len= strlen(start);
+ *argp= start + len;
+ }
}
if (!len) {
start= def;