mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 14:34:22 +00:00
bgpd: Prevent use after variable goes out of scope
`struct prefix p` was declared inside an if statement where we assign the address of to a pointer that is then passed to a sub function. This will eventually leave us in a bad state. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
d058d106f0
commit
cd44428d62
@ -12249,6 +12249,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
uint16_t show_flags = 0;
|
uint16_t show_flags = 0;
|
||||||
enum rpki_states rpki_target_state = RPKI_NOT_BEING_USED;
|
enum rpki_states rpki_target_state = RPKI_NOT_BEING_USED;
|
||||||
|
struct prefix p;
|
||||||
|
|
||||||
if (uj) {
|
if (uj) {
|
||||||
argc--;
|
argc--;
|
||||||
@ -12401,7 +12402,6 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
|
|||||||
if (argv_find(argv, argc, "A.B.C.D/M", &idx)
|
if (argv_find(argv, argc, "A.B.C.D/M", &idx)
|
||||||
|| argv_find(argv, argc, "X:X::X:X/M", &idx)) {
|
|| argv_find(argv, argc, "X:X::X:X/M", &idx)) {
|
||||||
const char *prefix_str = argv[idx]->arg;
|
const char *prefix_str = argv[idx]->arg;
|
||||||
struct prefix p;
|
|
||||||
|
|
||||||
if (!str2prefix(prefix_str, &p)) {
|
if (!str2prefix(prefix_str, &p)) {
|
||||||
vty_out(vty, "%% Malformed Prefix\n");
|
vty_out(vty, "%% Malformed Prefix\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user