From f258bb20c290e41fff4a74e08ad0e55304a3709a Mon Sep 17 00:00:00 2001 From: Ian Bruene Date: Mon, 26 Nov 2018 13:16:48 -0600 Subject: Removed variable length arrays, added -Wvla compiler option. --- libgpsd_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libgpsd_core.c') diff --git a/libgpsd_core.c b/libgpsd_core.c index b2ed639b..a752f10f 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -464,7 +464,7 @@ int gpsd_open(struct gps_device_t *session) return session->gpsdata.gps_fd; /* otherwise, could be an TCP data feed */ } else if (str_starts_with(session->gpsdata.dev.path, "tcp://")) { - char server[strlen(session->gpsdata.dev.path)+1], *port; + char server[GPS_PATH_MAX], *port; socket_t dsock; (void)strlcpy(server, session->gpsdata.dev.path + 6, sizeof(server)); INVALIDATE_SOCKET(session->gpsdata.gps_fd); @@ -491,7 +491,7 @@ int gpsd_open(struct gps_device_t *session) return session->gpsdata.gps_fd; /* or could be UDP */ } else if (str_starts_with(session->gpsdata.dev.path, "udp://")) { - char server[strlen(session->gpsdata.dev.path)+1], *port; + char server[GPS_PATH_MAX], *port; socket_t dsock; (void)strlcpy(server, session->gpsdata.dev.path + 6, sizeof(server)); INVALIDATE_SOCKET(session->gpsdata.gps_fd); @@ -520,7 +520,7 @@ int gpsd_open(struct gps_device_t *session) #endif /* NETFEED_ENABLE */ #ifdef PASSTHROUGH_ENABLE if (str_starts_with(session->gpsdata.dev.path, "gpsd://")) { - char server[strlen(session->gpsdata.dev.path)+1], *port; + char server[GPS_PATH_MAX], *port; socket_t dsock; (void)strlcpy(server, session->gpsdata.dev.path + 7, sizeof(server)); INVALIDATE_SOCKET(session->gpsdata.gps_fd); -- cgit v1.2.1