summaryrefslogtreecommitdiffstats
path: root/pimd/pim_oil.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2018-08-18 04:33:38 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2018-08-21 21:05:09 +0200
commita2dc7057e0bd3a5f5c28de9896bf905e6dd5eb4b (patch)
tree02d1dbdd3c616f371b7e42a0098d16981f843e05 /pimd/pim_oil.c
parentbuild: wrap "fallthrough" attr (diff)
downloadfrr-a2dc7057e0bd3a5f5c28de9896bf905e6dd5eb4b.tar.xz
frr-a2dc7057e0bd3a5f5c28de9896bf905e6dd5eb4b.zip
*: fix gcc-8 format-overflow warnings
e.g. pimd/pim_oil.c: In function ‘pim_channel_oil_dump’: pimd/pim_oil.c:51:19: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Werror=format-overflow=] Build on gcc-8.2.0 is warning-free after this patch. Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'pimd/pim_oil.c')
-rw-r--r--pimd/pim_oil.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c
index f0f336fb7..a0debc0c7 100644
--- a/pimd/pim_oil.c
+++ b/pimd/pim_oil.c
@@ -37,19 +37,20 @@
char *pim_channel_oil_dump(struct channel_oil *c_oil, char *buf, size_t size)
{
+ char *out;
struct prefix_sg sg;
int i;
sg.src = c_oil->oil.mfcc_origin;
sg.grp = c_oil->oil.mfcc_mcastgrp;
- sprintf(buf, "%s IIF: %d, OIFS: ", pim_str_sg_dump(&sg),
- c_oil->oil.mfcc_parent);
+ snprintf(buf, size, "%s IIF: %d, OIFS: ", pim_str_sg_dump(&sg),
+ c_oil->oil.mfcc_parent);
+ out = buf + strlen(buf);
for (i = 0; i < MAXVIFS; i++) {
if (c_oil->oil.mfcc_ttls[i] != 0) {
- char buf1[10];
- sprintf(buf1, "%d ", i);
- strcat(buf, buf1);
+ snprintf(out, buf + size - out, "%d ", i);
+ out += strlen(out);
}
}