Use strncmp to compare array to string
authorJochen Sprickerhof <git@jochen.sprickerhof.de>
Tue, 21 Apr 2020 17:28:49 +0000 (19:28 +0200)
committerJochen Sprickerhof <jspricke@debian.org>
Tue, 21 Apr 2020 17:40:57 +0000 (18:40 +0100)
Gbp-Pq: Name 0014-Use-strncmp-to-compare-array-to-string.patch

v900.cc

diff --git a/v900.cc b/v900.cc
index 775b9633c0c4dd417e557094242b325304abe003..91c233b833f633e9a264e1b9677041daadd0ec1f 100644 (file)
--- a/v900.cc
+++ b/v900.cc
@@ -328,11 +328,11 @@ v900_read()
       wpt->pdop = atof(line.adv.pdop);
 
       /* handle fix mode (2d, 3d, etc.) */
-      if (!strcmp(line.adv.valid,"DGPS")) {
+      if (!strncmp(line.adv.valid,"DGPS", sizeof line.adv.valid)) {
         wpt->fix = fix_dgps;
-      } else if (!strcmp(line.adv.fixmode,"3D")) {
+      } else if (!strncmp(line.adv.fixmode,"3D", sizeof line.adv.fixmode)) {
         wpt->fix = fix_3d;
-      } else if (!strcmp(line.adv.fixmode,"2D")) {
+      } else if (!strncmp(line.adv.fixmode,"2D", sizeof line.adv.fixmode)) {
         wpt->fix = fix_2d;
       } else
         /* possible values: fix_unknown,fix_none,fix_2d,fix_3d,fix_dgps,fix_pps */