diff options
-rw-r--r-- | driver_nmea2000.c | 2 | ||||
-rw-r--r-- | ppsthread.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/driver_nmea2000.c b/driver_nmea2000.c index 6f938e00..c5c6a8b1 100644 --- a/driver_nmea2000.c +++ b/driver_nmea2000.c @@ -1701,7 +1701,7 @@ int nmea2000_open(struct gps_device_t *session) session->driver.nmea2000.unit = unit_number; session->driver.nmea2000.unit_valid = true; } else { - strncpy(can_interface_name[can_net], + strlcpy(can_interface_name[can_net], interface_name, MIN(sizeof(can_interface_name[0]), sizeof(interface_name))); session->driver.nmea2000.unit_valid = false; diff --git a/ppsthread.c b/ppsthread.c index dfb55be5..b0b5303a 100644 --- a/ppsthread.c +++ b/ppsthread.c @@ -190,7 +190,7 @@ static int init_kernel_pps(struct inner_context_t *inner_context) * strlcpy() is not available.) */ if (strncmp(pps_thread->devicename, "/dev/pps", 8) == 0) - (void)strncpy(path, pps_thread->devicename, sizeof(path)); + (void)strncpy(path, pps_thread->devicename, sizeof(path)-1); else { char pps_num = '\0'; /* /dev/pps[pps_num] is our device */ size_t i; /* to match type of globbuf.gl_pathc */ |