On Thu, Aug 16, 2012 at 10:22 AM, Liu Yuan <namei.unix at gmail.com> wrote: > On 08/16/2012 02:36 AM, Yunkai Zhang wrote: >> From: Yunkai Zhang <qiushu.zyk at taobao.com> >> >> add tailing '\0' to hex buffer >> >> Signed-off-by: Yunkai Zhang <qiushu.zyk at taobao.com> >> --- >> sheep/farm/sha1_file.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/sheep/farm/sha1_file.c b/sheep/farm/sha1_file.c >> index b0abc16..493ca79 100644 >> --- a/sheep/farm/sha1_file.c >> +++ b/sheep/farm/sha1_file.c >> @@ -270,5 +270,6 @@ char *sha1_to_hex(const unsigned char *sha1) >> *buf++ = hex[val >> 4]; >> *buf++ = hex[val & 0xf]; >> } >> + buffer[2 * SHA1_LEN] = 0; >> return buffer; >> } >> > > I don't think this is a problem. We define 'static char buffer[50];' > which will be initialized as 0. OK, sorry. > > Thanks, > Yuan -- Yunkai Zhang Work at Taobao |