summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a14c225)
raw | patch | inline | side by side (parent: a14c225)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Thu, 22 Dec 2005 17:55:59 +0000 (18:55 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 22 Dec 2005 20:52:37 +0000 (12:52 -0800) |
sha1_to_hex() returns a pointer to a static buffer. Some of its users
modify that buffer by appending a newline character. Other users rely
on the fact that you can call
printf("%s", sha1_to_hex(sha1));
Just to be on the safe side, terminate the SHA1 in sha1_to_hex().
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
modify that buffer by appending a newline character. Other users rely
on the fact that you can call
printf("%s", sha1_to_hex(sha1));
Just to be on the safe side, terminate the SHA1 in sha1_to_hex().
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
sha1_file.c | patch | blob | history |
diff --git a/sha1_file.c b/sha1_file.c
index 601147351d251b305c122dcfae6dbdae72b08bb5..d451a94efed7d36d55cf1b77324eaf55e0d50d69 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
*buf++ = hex[val >> 4];
*buf++ = hex[val & 0xf];
}
+ *buf = '\0';
+
return buffer;
}