sha1_to_hex: properly terminate the SHA1

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>
This commit is contained in:
Johannes Schindelin 2005-12-22 18:55:59 +01:00 коммит произвёл Junio C Hamano
Родитель a14c225661
Коммит 1e80e04492
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

@ -81,6 +81,8 @@ char * sha1_to_hex(const unsigned char *sha1)
*buf++ = hex[val >> 4];
*buf++ = hex[val & 0xf];
}
*buf = '\0';
return buffer;
}