mirror of https://github.com/mpv-player/mpv
bstr: don't call memcpy(..., NULL, 0)
This is clearly not allowed, although it's not a problem on most libcs. Found by Coverity.
This commit is contained in:
parent
85fb2af369
commit
9c456ab58f
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue