eigrpd nhrpd ospfd pimd: fomat fixes (PVS-Studio)

Signed-off-by: F. Aragon <paco@voltanet.io>
This commit is contained in:
F. Aragon 2018-07-02 17:32:05 +02:00
parent 8d6d6b2581
commit 0651460e00
No known key found for this signature in database
GPG Key ID: FD112A8C7E6A5E4A
4 changed files with 8 additions and 7 deletions

View File

@ -417,7 +417,8 @@ void eigrp_sw_version_initialize(void)
if (dash) if (dash)
dash[0] = '\0'; dash[0] = '\0';
ret = sscanf(ver_string, "%d.%d", &FRR_MAJOR, &FRR_MINOR); ret = sscanf(ver_string, "%" SCNu32 ".%" SCNu32, &FRR_MAJOR,
&FRR_MINOR);
if (ret != 2) if (ret != 2)
zlog_err("Did not Properly parse %s, please fix VERSION string", zlog_err("Did not Properly parse %s, please fix VERSION string",
VERSION); VERSION);

View File

@ -59,7 +59,7 @@ static void evmgr_recv_message(struct event_manager *evmgr, struct zbuf *zb)
buf[len] = 0; buf[len] = 0;
debugf(NHRP_DEBUG_EVENT, "evmgr: msg: %s", buf); debugf(NHRP_DEBUG_EVENT, "evmgr: msg: %s", buf);
if (sscanf(buf, "eventid=%d", &eventid) != 1) if (sscanf(buf, "eventid=%" SCNu32, &eventid) != 1)
continue; continue;
if (sscanf(buf, "result=%63s", result) != 1) if (sscanf(buf, "result=%63s", result) != 1)
continue; continue;

View File

@ -1649,7 +1649,7 @@ DEFUN (pce_domain,
if (!ospf_ri_enabled(vty)) if (!ospf_ri_enabled(vty))
return CMD_WARNING_CONFIG_FAILED; return CMD_WARNING_CONFIG_FAILED;
if (sscanf(argv[idx_number]->arg, "%d", &as) != 1) { if (sscanf(argv[idx_number]->arg, "%" SCNu32, &as) != 1) {
vty_out(vty, "pce_domain: fscanf: %s\n", safe_strerror(errno)); vty_out(vty, "pce_domain: fscanf: %s\n", safe_strerror(errno));
return CMD_WARNING_CONFIG_FAILED; return CMD_WARNING_CONFIG_FAILED;
} }
@ -1684,7 +1684,7 @@ DEFUN (no_pce_domain,
uint32_t as; uint32_t as;
struct ospf_pce_info *pce = &OspfRI.pce_info; struct ospf_pce_info *pce = &OspfRI.pce_info;
if (sscanf(argv[idx_number]->arg, "%d", &as) != 1) { if (sscanf(argv[idx_number]->arg, "%" SCNu32, &as) != 1) {
vty_out(vty, "no_pce_domain: fscanf: %s\n", vty_out(vty, "no_pce_domain: fscanf: %s\n",
safe_strerror(errno)); safe_strerror(errno));
return CMD_WARNING_CONFIG_FAILED; return CMD_WARNING_CONFIG_FAILED;
@ -1718,7 +1718,7 @@ DEFUN (pce_neigbhor,
if (!ospf_ri_enabled(vty)) if (!ospf_ri_enabled(vty))
return CMD_WARNING_CONFIG_FAILED; return CMD_WARNING_CONFIG_FAILED;
if (sscanf(argv[idx_number]->arg, "%d", &as) != 1) { if (sscanf(argv[idx_number]->arg, "%" SCNu32, &as) != 1) {
vty_out(vty, "pce_neighbor: fscanf: %s\n", vty_out(vty, "pce_neighbor: fscanf: %s\n",
safe_strerror(errno)); safe_strerror(errno));
return CMD_WARNING_CONFIG_FAILED; return CMD_WARNING_CONFIG_FAILED;
@ -1754,7 +1754,7 @@ DEFUN (no_pce_neighbor,
uint32_t as; uint32_t as;
struct ospf_pce_info *pce = &OspfRI.pce_info; struct ospf_pce_info *pce = &OspfRI.pce_info;
if (sscanf(argv[idx_number]->arg, "%d", &as) != 1) { if (sscanf(argv[idx_number]->arg, "%" SCNu32, &as) != 1) {
vty_out(vty, "no_pce_neighbor: fscanf: %s\n", vty_out(vty, "no_pce_neighbor: fscanf: %s\n",
safe_strerror(errno)); safe_strerror(errno));
return CMD_WARNING_CONFIG_FAILED; return CMD_WARNING_CONFIG_FAILED;

View File

@ -202,7 +202,7 @@ static int pim_zebra_if_state_up(int command, struct zclient *zclient,
* If we have a pimreg device callback and it's for a specific * If we have a pimreg device callback and it's for a specific
* table set the master appropriately * table set the master appropriately
*/ */
if (sscanf(ifp->name, "pimreg%d", &table_id) == 1) { if (sscanf(ifp->name, "pimreg%" SCNu32, &table_id) == 1) {
struct vrf *vrf; struct vrf *vrf;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) { RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if ((table_id == vrf->data.l.table_id) if ((table_id == vrf->data.l.table_id)