Skip to content
Permalink
Browse files

*: 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>
  • Loading branch information...
eqvinox committed Aug 18, 2018
1 parent bd27ea4 commit a2dc7057e0bd3a5f5c28de9896bf905e6dd5eb4b
Showing with 9 additions and 8 deletions.
  1. +1 −1 bgpd/bgp_flowspec.c
  2. +2 −2 pimd/pim_cmd.c
  3. +6 −5 pimd/pim_oil.c
@@ -148,7 +148,7 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,

if (BGP_DEBUG(flowspec, FLOWSPEC)) {
char return_string[BGP_FLOWSPEC_NLRI_STRING_MAX];
char local_string[BGP_FLOWSPEC_NLRI_STRING_MAX * 2];
char local_string[BGP_FLOWSPEC_NLRI_STRING_MAX*2+16];
char ec_string[BGP_FLOWSPEC_NLRI_STRING_MAX];
char *s = NULL;

@@ -323,8 +323,8 @@ static void pim_show_assert_winner_metric_helper(struct vty *vty,
char addr_str[INET_ADDRSTRLEN];
struct pim_assert_metric *am;
struct in_addr ifaddr;
char pref_str[5];
char metr_str[7];
char pref_str[16];
char metr_str[16];

ifaddr = pim_ifp->primary_address;

@@ -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);
}
}

0 comments on commit a2dc705

Please sign in to comment.
You can’t perform that action at this time.