From 31ce2e452f705f329990f50379f65e625fbd334d Mon Sep 17 00:00:00 2001 From: James Bensley Date: Sun, 5 Mar 2023 13:08:11 +0100 Subject: [PATCH] Fix issue bgp#83 - fix regression bug which ignored -S CLI option (#1) (#85) * Fix issue bgp#83 - fix regression bug which ignored -S CLI option (#1) * Fix issue #83 - fix regression bug which ignored -S CLI option, introduced by commit 08b81f7d1973b8ccdbf627bb60063a97bc1c1fed --------- Co-authored-by: James Bensley * Fix off-by-one error * Swap strlcpy for strdup --------- Co-authored-by: James Bensley --- expander.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/expander.c b/expander.c index a139dec..7ec87c0 100644 --- a/expander.c +++ b/expander.c @@ -1160,11 +1160,11 @@ bgpq_expand(struct bgpq_expander *b) } } - if (b->usesource) { + if (b->sources && b->sources[0] != 0) { + b->defaultsources = strdup(b->sources); + } else if (b->usesource) { if (b->sources && b->sources[0] != 0) { - b->defaultsources = (char*)calloc(1, strlen(b->sources)); - strlcpy(b->defaultsources, b->sources, - sizeof(b->defaultsources)); + b->defaultsources = strdup(b->sources); } else { b->defaultsources = bgpq_get_irrd_sources(b->fd); }