summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-05-24 18:49:17 -0400
committerEric S. Raymond <esr@thyrsus.com>2012-05-29 05:01:33 -0400
commit0a0f49b6b89049bac374c839f069132d025fc1e7 (patch)
tree3a4e27bb0a82cdd825cdec6311c4aafd695ebcf6 /gpsd.c
parent5b146d26118d659a3373b4c76cdd89f48971e367 (diff)
downloadgpsd-0a0f49b6b89049bac374c839f069132d025fc1e7.tar.gz
Don't try to add devices with long paths.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com> Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gpsd.c b/gpsd.c
index 42077023..453e9d4e 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)) {