From 9c456ab58f7b298400a050aecdf49de4e035528d Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 21 Nov 2014 05:13:40 +0100 Subject: bstr: don't call memcpy(..., NULL, 0) This is clearly not allowed, although it's not a problem on most libcs. Found by Coverity. --- misc/bstr.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'misc') diff --git a/misc/bstr.c b/misc/bstr.c index 7a5a1a1270..7db7015e1c 100644 --- a/misc/bstr.c +++ b/misc/bstr.c @@ -379,6 +379,8 @@ static void resize_append(void *talloc_ctx, bstr *s, size_t append_min) // talloc_ctx will be used as parent context, if s->start is NULL. void bstr_xappend(void *talloc_ctx, bstr *s, bstr append) { + if (!append.len) + return; resize_append(talloc_ctx, s, append.len + 1); memcpy(s->start + s->len, append.start, append.len); s->len += append.len; -- cgit v1.2.3