mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
Merge pull request #3407 from oni-link/fix.ga_concat
garray.c: Prevent ga_concat() using memcpy(NULL,...)
This commit is contained in:
@@ -184,10 +184,12 @@ char_u* ga_concat_strings(const garray_T *gap) FUNC_ATTR_NONNULL_RET
|
|||||||
void ga_concat(garray_T *gap, const char_u *restrict s)
|
void ga_concat(garray_T *gap, const char_u *restrict s)
|
||||||
{
|
{
|
||||||
int len = (int)strlen((char *) s);
|
int len = (int)strlen((char *) s);
|
||||||
ga_grow(gap, len);
|
if (len) {
|
||||||
char *data = gap->ga_data;
|
ga_grow(gap, len);
|
||||||
memcpy(data + gap->ga_len, s, (size_t) len);
|
char *data = gap->ga_data;
|
||||||
gap->ga_len += len;
|
memcpy(data + gap->ga_len, s, (size_t)len);
|
||||||
|
gap->ga_len += len;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Append one byte to a growarray which contains bytes.
|
/// Append one byte to a growarray which contains bytes.
|
||||||
|
Reference in New Issue
Block a user