{"thread":{"id":"44073","subject":"[PATCH] strbuf: use valid pointer in strbuf_remove()","startedAt":"2016-09-13T16:40:49Z","lastAt":"2016-09-13T18:14:29Z","messageCount":2,"participants":["René Scharfe","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"301852","messageId":"408af1a3-6867-2ff5-c97f-3eb884412ad8@web.de","threadId":"44073","inReplyTo":null,"subject":"[PATCH] strbuf: use valid pointer in strbuf_remove()","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2016-09-13T16:40:22Z","receivedAt":"2016-09-13T16:40:49Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"The fourth argument of strbuf_splice() is passed to memcpy(3), which is\nnot supposed to handle NULL pointers.  Let's be extra careful and use a\nvalid empty string instead.  It even shortens the source code. :)\n\nSigned-off-by: Rene Scharfe <l.s.r@web.de>\n---\n strbuf.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/strbuf.c b/strbuf.c\nindex f3bd571..b839be4 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -187,7 +187,7 @@ void strbuf_insert(struct strbuf *sb, size_t pos, const void *data, size_t len)\n \n void strbuf_remove(struct strbuf *sb, size_t pos, size_t len)\n {\n-\tstrbuf_splice(sb, pos, len, NULL, 0);\n+\tstrbuf_splice(sb, pos, len, \"\", 0);\n }\n \n void strbuf_add(struct strbuf *sb, const void *data, size_t len)\n-- \n2.10.0\n"},{"id":"301863","messageId":"20160913181420.ebsiscqk3sbc7axl@sigill.intra.peff.net","threadId":"44073","inReplyTo":"408af1a3-6867-2ff5-c97f-3eb884412ad8@web.de","subject":"Re: [PATCH] strbuf: use valid pointer in strbuf_remove()","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-13T18:14:21Z","receivedAt":"2016-09-13T18:14:29Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Sep 13, 2016 at 06:40:22PM +0200, René Scharfe wrote:\n\n> The fourth argument of strbuf_splice() is passed to memcpy(3), which is\n> not supposed to handle NULL pointers.  Let's be extra careful and use a\n> valid empty string instead.  It even shortens the source code. :)\n\nHeh. Looks obviously correct and like a good thing to do.\n\n-Peff\n"}]}