mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 04:25:43 +00:00
bgpd, lib, ospf6d, vtysh: fix possible snprintf possible truncation
With a new version of clang 6.0, the compiler is detecting more issues where we may be possibly be truncating the output string. Fix by increasing the size of the output string to make the compiler happy. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
b1599bb6f4
commit
ff44f57014
@ -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];
|
||||
char local_string[BGP_FLOWSPEC_NLRI_STRING_MAX * 2];
|
||||
char ec_string[BGP_FLOWSPEC_NLRI_STRING_MAX];
|
||||
char *s = NULL;
|
||||
|
||||
@ -157,20 +157,19 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
|
||||
p.u.prefix_flowspec.prefixlen,
|
||||
return_string,
|
||||
NLRI_STRING_FORMAT_MIN, NULL);
|
||||
snprintf(ec_string, BGP_FLOWSPEC_NLRI_STRING_MAX,
|
||||
snprintf(ec_string, sizeof(ec_string),
|
||||
"EC{none}");
|
||||
if (attr && attr->ecommunity) {
|
||||
s = ecommunity_ecom2str(attr->ecommunity,
|
||||
ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
|
||||
snprintf(ec_string,
|
||||
BGP_FLOWSPEC_NLRI_STRING_MAX,
|
||||
snprintf(ec_string, sizeof(ec_string),
|
||||
"EC{%s}",
|
||||
s == NULL ? "none" : s);
|
||||
|
||||
if (s)
|
||||
ecommunity_strfree(&s);
|
||||
}
|
||||
snprintf(local_string, BGP_FLOWSPEC_NLRI_STRING_MAX,
|
||||
snprintf(local_string, sizeof(local_string),
|
||||
"FS Rx %s %s %s %s", withdraw ?
|
||||
"Withdraw":"Update",
|
||||
afi2str(afi), return_string,
|
||||
|
@ -7063,8 +7063,8 @@ void route_vty_out_tag(struct vty *vty, struct prefix *p,
|
||||
|| (safi == SAFI_EVPN
|
||||
&& BGP_ATTR_NEXTHOP_AFI_IP6(attr))
|
||||
|| (BGP_ATTR_NEXTHOP_AFI_IP6(attr))) {
|
||||
char buf_a[BUFSIZ];
|
||||
char buf_b[BUFSIZ];
|
||||
char buf_a[512];
|
||||
char buf_b[512];
|
||||
char buf_c[BUFSIZ];
|
||||
if (attr->mp_nexthop_len
|
||||
== BGP_ATTR_NHLEN_IPV6_GLOBAL) {
|
||||
@ -11421,7 +11421,7 @@ static void bgp_config_write_network_evpn(struct vty *vty, struct bgp *bgp,
|
||||
struct prefix *p;
|
||||
struct prefix_rd *prd;
|
||||
struct bgp_static *bgp_static;
|
||||
char buf[PREFIX_STRLEN];
|
||||
char buf[PREFIX_STRLEN * 2];
|
||||
char buf2[SU_ADDRSTRLEN];
|
||||
char rdbuf[RD_ADDRSTRLEN];
|
||||
|
||||
|
@ -47,9 +47,9 @@ const char frr_moduledir[] = MODULE_PATH;
|
||||
char frr_protoname[256] = "NONE";
|
||||
char frr_protonameinst[256] = "NONE";
|
||||
|
||||
char config_default[256];
|
||||
char config_default[512];
|
||||
char frr_zclientpath[256];
|
||||
static char pidfile_default[256];
|
||||
static char pidfile_default[512];
|
||||
static char vtypath_default[256];
|
||||
|
||||
bool debug_memstats_at_exit = 0;
|
||||
|
@ -113,7 +113,7 @@ extern void frr_early_fini(void);
|
||||
DECLARE_KOOH(frr_fini, (), ())
|
||||
extern void frr_fini(void);
|
||||
|
||||
extern char config_default[256];
|
||||
extern char config_default[512];
|
||||
extern char frr_zclientpath[256];
|
||||
extern const char frr_sysconfdir[];
|
||||
extern const char frr_vtydir[];
|
||||
|
@ -75,7 +75,7 @@ struct frrmod_runtime *frrmod_load(const char *spec, const char *dir, char *err,
|
||||
size_t err_len)
|
||||
{
|
||||
void *handle = NULL;
|
||||
char name[PATH_MAX], fullpath[PATH_MAX], *args;
|
||||
char name[PATH_MAX], fullpath[PATH_MAX * 2], *args;
|
||||
struct frrmod_runtime *rtinfo, **rtinfop;
|
||||
const struct frrmod_info *info;
|
||||
|
||||
|
@ -35,7 +35,7 @@ extern unsigned char conf_debug_ospf6_neighbor;
|
||||
/* Neighbor structure */
|
||||
struct ospf6_neighbor {
|
||||
/* Neighbor Router ID String */
|
||||
char name[32];
|
||||
char name[36];
|
||||
|
||||
/* OSPFv3 Interface this neighbor belongs to */
|
||||
struct ospf6_interface *ospf6_if;
|
||||
|
@ -52,8 +52,8 @@ static gid_t elevgid, realgid;
|
||||
#define FRR_CONFIG_NAME "frr.conf"
|
||||
|
||||
/* Configuration file name and directory. */
|
||||
static char vtysh_config[MAXPATHLEN];
|
||||
char frr_config[MAXPATHLEN];
|
||||
static char vtysh_config[MAXPATHLEN * 3];
|
||||
char frr_config[MAXPATHLEN * 3];
|
||||
char vtydir[MAXPATHLEN];
|
||||
static char history_file[MAXPATHLEN];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user