aboutsummaryrefslogtreecommitdiffstats
path: root/src/vty/utils.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2013-08-06 14:29:14 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-08-06 14:56:30 +0200
commitae15a2cac1a01e98e34b4ccd8932ae8f1b99186c (patch)
tree802d601560c648b886bcca545fbc17846c94ef46 /src/vty/utils.c
parenta652abc5bf75435ba7f1c96ed914cf5805fc326f (diff)
vty: Fix misusage of snprintf in vty/utils.c
Compiled with ubuntu 1204 (precise), where -Wformat-security is enabled by -Wall. Test yields ok, but the current implementation doesn't properly support multi-character separators and end strings. So the test output is truncated. Addresses: utils.c: In function 'vty_cmd_string_from_valstr': utils.c:84:2: warning: format not a string literal and no format arguments [-Wformat-security] utils.c:84:2: warning: format not a string literal and no format arguments [-Wformat-security] utils.c:108:2: warning: format not a string literal and no format arguments [-Wformat-security] utils.c:108:2: warning: format not a string literal and no format arguments [-Wformat-security]
Diffstat (limited to 'src/vty/utils.c')
-rw-r--r--src/vty/utils.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vty/utils.c b/src/vty/utils.c
index e9c0d2d7..88932fa8 100644
--- a/src/vty/utils.c
+++ b/src/vty/utils.c
@@ -81,7 +81,7 @@ char *vty_cmd_string_from_valstr(void *ctx, const struct value_string *vals,
if (!str)
return NULL;
- ret = snprintf(str + offset, rem, prefix);
+ ret = snprintf(str + offset, rem, "%s", prefix);
if (ret < 0)
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);
@@ -105,7 +105,7 @@ char *vty_cmd_string_from_valstr(void *ctx, const struct value_string *vals,
offset--; /* to remove the trailing | */
rem++;
- ret = snprintf(str + offset, rem, end);
+ ret = snprintf(str + offset, rem, "%s", end);
if (ret < 0)
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);