gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] possible driver_ubx runtime bug introduced


From: Jon Schlueter
Subject: [gpsd-dev] possible driver_ubx runtime bug introduced
Date: Fri, 11 May 2012 15:27:54 -0400

I was looking back through commits and noticed that the ubx_write
parameters changed even though the commit should have been just a
coverty warning fixup.  This change could result in a very subtle run
time bug in probing/setting up a UBX gps.  I don't have one to check
with but thought I should bring it up on the list.

Jon Schlueter

9d7dc31b595b91aeb258faca459909b0b5b7965e

@@ -714,7 +714,7 @@ static bool ubx_speed(struct gps_device_t *session,
        usart_mode |= 0x2000;   /* zero value means 1 stop bit */
     putle32(buf, 4, usart_mode);
     putle32(buf, 8, speed);
-    (void)ubx_write(session, 0x06, 0x00, &buf[6], 20); /* send back
with all other settings intact */
+    (void)ubx_write(session, 0x06, 0x00, buf, sizeof(buf));    /* send
back with all other settings intact */
     /*@ -charint +usedef +compdef */
     return true;
 }

also

dbf6d322945e68fce36afd6dba75ab56d60b0c86

@@ -676,7 +675,7 @@ static void ubx_nmea_mode(struct gps_device_t
*session, int mode)
        buf[14] |= 0x01;        /* turn on UBX output on this port */
     }
     /*@ -charint +usedef @*/
-    (void)ubx_write(session, 0x06u, 0x00, &buf[6], 20);        /* send back
with all other settings intact */
+    (void)ubx_write(session, 0x06u, 0x00, buf, sizeof(buf));   /* send
back with all other settings intact */
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]