summaryrefslogtreecommitdiff
path: root/gpsd/gpsd-qpegps-0.9.2/nmea-fix.patch
blob: 8d6ec0b3ea8d28a8ba16b95dd69f7207ebe87f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--- gpsd-1.10/nmea_parse.c.orig	2004-03-01 23:32:52.147650832 +0000
+++ gpsd-1.10/nmea_parse.c	2004-03-01 23:32:43.544958640 +0000
@@ -261,7 +261,7 @@
     unsigned char sum = '\0';
     char c, *p = sentence;
 
-    while ((c = *p++) != '*')
+    while ((c = *p++) != '*' && c != '\0')
 	sum ^= c;
 
     sprintf(p, "%02X\r\n", sum);
@@ -276,10 +276,10 @@
 static char *field(char *sentence, short n)
 {
     static char result[100];
-    char *p = sentence;
+    char c, *p = sentence;
 
     while (n-- > 0)
-	while (*p++ != ',');
+	while ((c = *p++) != ',' && c != '\0');
     strcpy(result, p);
     p = result;
     while (*p && *p != ',' && *p != '*' && *p != '\r')