Skip to content

Commit

Permalink
Defensive coding for the presence of NULs.
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-s-raymond committed Mar 30, 2015
1 parent bc6f155 commit ecb7e1f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gpsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -988,13 +988,13 @@ static void set_serial(struct gps_device_t *device,

while (isspace((unsigned char) *modestring))
modestring++;
if (strchr("78", *modestring) != NULL) {
if (*modestring && strchr("78", *modestring) != NULL) {
wordsize = (int)(*modestring++ - '0');
if (strchr("NOE", *modestring) != NULL) {
if (*modestring && strchr("NOE", *modestring) != NULL) {
parity = *modestring++;
while (isspace((unsigned char) *modestring))
modestring++;
if (strchr("12", *modestring) != NULL)
if (*modestring && strchr("12", *modestring) != NULL)
stopbits = (unsigned int)(*modestring - '0');
}
}
Expand Down

0 comments on commit ecb7e1f

Please sign in to comment.