Skip to content
Permalink
Browse files

Merge pull request #3561 from opensourcerouting/northbound-freebsd-fix

lib: fix segfault on freebsd when using vsnprintf() incorrectly
  • Loading branch information...
qlyoung committed Jan 3, 2019
2 parents cb6aafa + 3cb4162 commit c05f659a58466dd1a8dfe2a2ebbefeeb0b9c8ee0
Showing with 9 additions and 6 deletions.
  1. +8 −5 lib/northbound_cli.c
  2. +1 −1 lib/northbound_cli.h
@@ -79,8 +79,7 @@ void nb_cli_enqueue_change(struct vty *vty, const char *xpath,
int nb_cli_apply_changes(struct vty *vty, const char *xpath_base_fmt, ...)
{
struct nb_config *candidate_transitory;
char xpath_base[XPATH_MAXLEN];
va_list ap;
char xpath_base[XPATH_MAXLEN] = {};
bool error = false;
int ret;

@@ -94,9 +93,13 @@ int nb_cli_apply_changes(struct vty *vty, const char *xpath_base_fmt, ...)
candidate_transitory = nb_config_dup(vty->candidate_config);

/* Parse the base XPath format string. */
va_start(ap, xpath_base_fmt);
vsnprintf(xpath_base, sizeof(xpath_base), xpath_base_fmt, ap);
va_end(ap);
if (xpath_base_fmt) {
va_list ap;

va_start(ap, xpath_base_fmt);
vsnprintf(xpath_base, sizeof(xpath_base), xpath_base_fmt, ap);
va_end(ap);
}

/* Edit candidate configuration. */
for (size_t i = 0; i < vty->num_cfg_changes; i++) {
@@ -60,7 +60,7 @@ extern void nb_cli_enqueue_change(struct vty *vty, const char *xpath,
*
* xpath_base_fmt
* Prepend the given XPath (absolute or relative) to all enqueued
* configuration changes.
* configuration changes. This is an optional parameter.
*
* Returns:
* CMD_SUCCESS on success, CMD_WARNING_CONFIG_FAILED otherwise.

0 comments on commit c05f659

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