aboutsummaryrefslogtreecommitdiffstats
path: root/utils/rds-ctl/rds-ctl.cpp
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2018-07-30 10:06:30 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2018-07-30 10:06:30 +0200
commitfcbe44439afdfd78b6bebe82585fa27f8eb6f606 (patch)
treea526c1779041b96093115ea3064c1b74bdce96ab /utils/rds-ctl/rds-ctl.cpp
parent50b30c46ac6ae92a80167054e3dd691181db21c6 (diff)
stress-buffer/libmedia_dev/rds-ctl: fix gcc-8.1 warnings
Fix various snprintf warnings of this type: get_media_devices.c: In function ‘get_class’: get_media_devices.c:147:33: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 0 and 4095 [-Wformat-truncation=] snprintf(fname, PATH_MAX, "%s/%s", dname, entry->d_name); ^~ get_media_devices.c:147:3: note: ‘snprintf’ output between 2 and 4352 bytes into a destination of size 4096 snprintf(fname, PATH_MAX, "%s/%s", dname, entry->d_name); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Diffstat (limited to 'utils/rds-ctl/rds-ctl.cpp')
-rw-r--r--utils/rds-ctl/rds-ctl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
index 05b882e3..3e68abeb 100644
--- a/utils/rds-ctl/rds-ctl.cpp
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -765,7 +765,7 @@ static int parse_cl(int argc, char **argv)
params.options[(int)opt] = 1;
switch (opt) {
case OptSetDevice:
- strncpy(params.fd_name, optarg, sizeof(params.fd_name));
+ strncpy(params.fd_name, optarg, sizeof(params.fd_name) - 1);
if (optarg[0] >= '0' && optarg[0] <= '9' && strlen(optarg) <= 3) {
snprintf(params.fd_name, sizeof(params.fd_name), "/dev/radio%s", optarg);
}

Privacy Policy