summaryrefslogtreecommitdiffstats
path: root/lib/sbuf.c
diff options
context:
space:
mode:
authorpaco <paco@voltanet.io>2018-06-15 16:54:09 +0200
committerpaco <paco@voltanet.io>2018-06-22 00:06:07 +0200
commit764f689bcf8f0d1dbb15d9ff65071bf06e5bfa1e (patch)
treeafb3cdf029f15e38233b6f9b230d7cdb42e7720c /lib/sbuf.c
parentMerge pull request #2426 from pacovn/Coverity_23089_Buffer_not_null_terminated (diff)
downloadfrr-764f689bcf8f0d1dbb15d9ff65071bf06e5bfa1e.tar.xz
frr-764f689bcf8f0d1dbb15d9ff65071bf06e5bfa1e.zip
lib: out-of-bounds access (Coverity 1452539)
Signed-off-by: F. Aragon <paco@voltanet.io>
Diffstat (limited to 'lib/sbuf.c')
-rw-r--r--lib/sbuf.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/sbuf.c b/lib/sbuf.c
index 37c1e5283..03a2be3e0 100644
--- a/lib/sbuf.c
+++ b/lib/sbuf.c
@@ -63,13 +63,12 @@ void sbuf_push(struct sbuf *buf, int indent, const char *format, ...)
int written;
if (!buf->fixed) {
- char dummy;
int written1, written2;
size_t new_size;
- written1 = snprintf(&dummy, 0, "%*s", indent, "");
+ written1 = indent;
va_start(args, format);
- written2 = vsnprintf(&dummy, 0, format, args);
+ written2 = vsnprintf(NULL, 0, format, args);
va_end(args);
new_size = buf->size;