gpsd-dev
[Top][All Lists]
Advanced

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

[gpsd-dev] [PATCH] Don't try to add devices with long paths.


From: Marti Bolivar
Subject: [gpsd-dev] [PATCH] Don't try to add devices with long paths.
Date: Thu, 24 May 2012 18:57:52 -0400
User-agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Signed-off-by: Marti Bolivar <address@hidden>
---
 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



reply via email to

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