From: Hal Murray Date: Sat, 26 Sep 2009 07:55:56 +0000 (-0400) Subject: ChangeLog, refclock_nmea.c: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19712794440b16fe3fe6191f8626cedc77976e7c;p=thirdparty%2Fntp.git ChangeLog, refclock_nmea.c: Fix for Bug 1316: segfault from refclock_nmea bk: 4abdc90cqensUNjmADEeQDe6RES7eQ --- diff --git a/ChangeLog b/ChangeLog index c7ab99f442..3493ed743f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* [Bug 1316] segfault if refclock_nmea can't open file. (4.2.5p220) 2009/09/25 Released by Harlan Stenn * Rearrange libisc code to match the upstream layout in BIND. This is step one of two, changing the layout but keeping our existing libisc. diff --git a/ntpd/refclock_nmea.c b/ntpd/refclock_nmea.c index 294791a2a9..f3c23fcb11 100644 --- a/ntpd/refclock_nmea.c +++ b/ntpd/refclock_nmea.c @@ -216,7 +216,7 @@ nmea_start( * ln -s server:port /dev/gps1 */ char buffer[80]; - char *nmea_host; + char *nmea_host, *nmea_tail; int nmea_port; int len; struct hostent *he; @@ -229,8 +229,10 @@ nmea_start( if ((nmea_host = strtok(buffer,":")) == NULL) return(0); + if ((nmea_tail = strtok(NULL,":")) == NULL) + return(0); - nmea_port = atoi(strtok(NULL,":")); + nmea_port = atoi(nmea_tail); if ((he = gethostbyname(nmea_host)) == NULL) return(0);