Skip to content

Commit a8342a4

Browse files
rscharfegitster
authored andcommitted
strbuf: use valid pointer in strbuf_remove()
The fourth argument of strbuf_splice() is passed to memcpy(3), which is not supposed to handle NULL pointers. Let's be extra careful and use a valid empty string instead. It even shortens the source code. :) Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 0b65a8d commit a8342a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

strbuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ void strbuf_insert(struct strbuf *sb, size_t pos, const void *data, size_t len)
187187

188188
void strbuf_remove(struct strbuf *sb, size_t pos, size_t len)
189189
{
190-
strbuf_splice(sb, pos, len, NULL, 0);
190+
strbuf_splice(sb, pos, len, "", 0);
191191
}
192192

193193
void strbuf_add(struct strbuf *sb, const void *data, size_t len)

0 commit comments

Comments
 (0)