mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
GPS: fix buffer overrun in nmeaProcess()
nmeaProcess was attempting to null-terminate the NMEA sentence but was not considering that the preceeding loop may have looped beyond the end of the packet buffer. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@709 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
a03b948fb5
commit
e2721136ae
@ -233,7 +233,11 @@ uint8_t nmeaProcess(cBuffer* rxBuffer)
|
||||
bufferGetFromFront(rxBuffer);
|
||||
}
|
||||
// null terminate it
|
||||
NmeaPacket[j] = 0;
|
||||
if (j<(NMEA_BUFFERSIZE-1)) {
|
||||
NmeaPacket[j] = 0;
|
||||
} else {
|
||||
NmeaPacket[NMEA_BUFFERSIZE-1] = 0;
|
||||
}
|
||||
// dump <CR><LF> from rxBuffer
|
||||
bufferGetFromFront(rxBuffer);
|
||||
bufferGetFromFront(rxBuffer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user