>From bc9cf995d84a1e3e29cf392406f13995b60136c4 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Thu, 24 May 2012 18:49:17 -0400 Subject: [PATCH] Don't try to add devices with long paths. Signed-off-by: Marti Bolivar --- gpsd.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/gpsd.c b/gpsd.c index 072a044..41b4cbc 100644 --- a/gpsd.c +++ b/gpsd.c @@ -707,6 +707,13 @@ static bool add_device(const char *device_name) { struct gps_device_t *devp; bool ret = false; + /* we can't handle paths longer than GPS_PATH_MAX, so don't try */ + if (strlen(device_name) >= GPS_PATH_MAX) { + gpsd_report(LOG_ERROR, + "ignoring device %s: path length exceeds maximum %d\n", + device_name, GPS_PATH_MAX); + return false; + } /* stash devicename away for probing when the first client connects */ for (devp = devices; devp < devices + MAXDEVICES; devp++) if (!allocated_device(devp)) { -- 1.7.0.4