]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ChangeLog, refclock_nmea.c:
authorHal Murray <murray@ntp.org>
Sat, 26 Sep 2009 07:55:56 +0000 (03:55 -0400)
committerHal Murray <murray@ntp.org>
Sat, 26 Sep 2009 07:55:56 +0000 (03:55 -0400)
  Fix for Bug 1316: segfault from refclock_nmea

bk: 4abdc90cqensUNjmADEeQDe6RES7eQ

ChangeLog
ntpd/refclock_nmea.c

index c7ab99f44260bb24b57dfecb6a9a6d5af1641757..3493ed743f81eb8c0d3d52b71dd3467b884a531f 100644 (file)
--- 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 <stenn@ntp.org>
 * Rearrange libisc code to match the upstream layout in BIND.  This is
   step one of two, changing the layout but keeping our existing libisc.
index 294791a2a9aac1d88ae7f399e9a18063d2c6531c..f3c23fcb11380f72d87e769635d646615379fb8c 100644 (file)
@@ -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);