From b4e12d616a76592e47598cbe8b1f8f67974629e9 Mon Sep 17 00:00:00 2001 From: martin-s Date: Sun, 16 Mar 2008 16:08:26 +0000 Subject: [PATCH] Fix:vehicle_gpsd:Fixed a buffer overrun git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@945 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/src/vehicle/gpsd/vehicle_gpsd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/navit/src/vehicle/gpsd/vehicle_gpsd.c b/navit/src/vehicle/gpsd/vehicle_gpsd.c index 9bd369e..2ed7626 100644 --- a/navit/src/vehicle/gpsd/vehicle_gpsd.c +++ b/navit/src/vehicle/gpsd/vehicle_gpsd.c @@ -44,8 +44,8 @@ vehicle_gpsd_callback(struct gps_data_t *data, char *buf, size_t len, { char *pos,*nmea_data_buf; struct vehicle_priv *priv = vehicle_last; - if (buf[0] == '$') { - char buffer[len+1]; + if (buf[0] == '$' && len > 0) { + char buffer[len+2]; buffer[len+1]='\0'; memcpy(buffer, buf, len); pos=strchr(buffer,'\n'); -- 2.7.4