summaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2016-09-13 16:40:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-09-13 23:07:37 (GMT)
commita8342a417e48385f7ebc19ab46a940ea1fa060ae (patch)
treed0b3415ceff91022553a6432cb7a185d988f109c /strbuf.c
parent0b65a8dbdb38962e700ee16776a3042beb489060 (diff)
downloadgit-a8342a417e48385f7ebc19ab46a940ea1fa060ae.zip
git-a8342a417e48385f7ebc19ab46a940ea1fa060ae.tar.gz
git-a8342a417e48385f7ebc19ab46a940ea1fa060ae.tar.bz2
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>
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/strbuf.c b/strbuf.c
index 2c08dbb..e554f1f 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -187,7 +187,7 @@ void strbuf_insert(struct strbuf *sb, size_t pos, const void *data, size_t len)
void strbuf_remove(struct strbuf *sb, size_t pos, size_t len)
{
- strbuf_splice(sb, pos, len, NULL, 0);
+ strbuf_splice(sb, pos, len, "", 0);
}
void strbuf_add(struct strbuf *sb, const void *data, size_t len)