diff options
author | paco <paco@voltanet.io> | 2018-06-15 16:54:09 +0200 |
---|---|---|
committer | paco <paco@voltanet.io> | 2018-06-22 00:06:07 +0200 |
commit | 764f689bcf8f0d1dbb15d9ff65071bf06e5bfa1e (patch) | |
tree | afb3cdf029f15e38233b6f9b230d7cdb42e7720c /lib/sbuf.c | |
parent | Merge pull request #2426 from pacovn/Coverity_23089_Buffer_not_null_terminated (diff) | |
download | frr-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.c | 5 |
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; |