diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2018-07-30 10:06:30 +0200 |
---|---|---|
committer | Hans Verkuil <hans.verkuil@cisco.com> | 2018-07-30 10:06:30 +0200 |
commit | fcbe44439afdfd78b6bebe82585fa27f8eb6f606 (patch) | |
tree | a526c1779041b96093115ea3064c1b74bdce96ab /utils/rds-ctl/rds-ctl.cpp | |
parent | 50b30c46ac6ae92a80167054e3dd691181db21c6 (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.cpp | 2 |
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); } |