summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-08-29 21:28:50 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-08-29 21:28:50 +0000
commit243e7496c9169138e44403446a300760bf5d750a (patch)
tree8e4eb1007a6f4ad9c2ccda995d145a1dbe0cc2f5 /gpsd.c
parent6b62b101250cacf8e55ca942e545ad00d0656035 (diff)
downloadgpsd-243e7496c9169138e44403446a300760bf5d750a.tar.gz
Prevent some SEGVs on ill-formed comands.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gpsd.c b/gpsd.c
index 13ee8e2a..1d5219c5 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1645,7 +1645,7 @@ static void handle_newstyle_request(struct subscriber_t *sub,
int status;
status = json_watch_read(buf+1, &sub->policy, &end);
if (status == 0) {
- if (*end == ';')
+ if (*end != NULL && *end == ';')
++end;
if (sub->policy.watcher)
for(devp = devices; devp < devices + MAXDEVICES; devp++)
@@ -1683,7 +1683,7 @@ static void handle_newstyle_request(struct subscriber_t *sub,
if (*buf == '=') {
int status;
status = json_device_read(buf+1, &devconf, &end);
- if (*end == ';')
+ if (end != NULL && *end == ';')
++end;
if (status != 0)
(void)snprintf(reply, replylen,