All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fetch--tool: fix uninitialized buffer when reading from stdin
@ 2007-02-26 12:08 Johannes Schindelin
  2007-02-26 16:24 ` Linus Torvalds
  0 siblings, 1 reply; 10+ messages in thread
From: Johannes Schindelin @ 2007-02-26 12:08 UTC (permalink / raw)
  To: git, junkio


Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 builtin-fetch--tool.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
index 48de08d..e5bb560 100644
--- a/builtin-fetch--tool.c
+++ b/builtin-fetch--tool.c
@@ -14,6 +14,10 @@ static char *get_stdin(void)
 		data = xrealloc(data, offset + CHUNK_SIZE);
 		read = xread(0, data + offset, CHUNK_SIZE);
 	}
+	if (read > 0 && data[read - 1] == '\n')
+		data[read - 1] = '\0';
+	else
+		data[read] = '\0';
 	return data;
 }
 
-- 
1.5.0.1.2424.g39563

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-02-27 19:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-26 12:08 [PATCH] fetch--tool: fix uninitialized buffer when reading from stdin Johannes Schindelin
2007-02-26 16:24 ` Linus Torvalds
2007-02-26 16:47   ` Johannes Schindelin
2007-02-26 17:06     ` Linus Torvalds
2007-02-26 17:27       ` Johannes Schindelin
2007-02-26 17:28       ` Johannes Schindelin
2007-02-26 18:05         ` Linus Torvalds
2007-02-26 19:21           ` Junio C Hamano
2007-02-26 19:37           ` Junio C Hamano
2007-02-27 19:35             ` Johannes Schindelin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.