summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorPeter Eriksen <s022018@student.dtu.dk>2006-06-11 14:03:28 +0200
committerJunio C Hamano <junkio@cox.net>2006-06-16 22:45:12 -0700
commitbfbd0bb6ecbbbf75a5caaff6afaf5a6af8fa518e (patch)
tree52f36804599a41eafa3a020f06dbe118c6f652f9 /sha1_name.c
parent5996ca0836e21ab4e6be0a16a615eff965f18b8b (diff)
downloadgit-bfbd0bb6ecbbbf75a5caaff6afaf5a6af8fa518e.tar.gz
Implement safe_strncpy() as strlcpy() and use it more.
Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sha1_name.c b/sha1_name.c
index fbbde1cf7d..8fe9b7a75f 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -262,8 +262,7 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
if (str[am] == '@' && str[am+1] == '{' && str[len-1] == '}') {
int date_len = len - am - 3;
char *date_spec = xmalloc(date_len + 1);
- strncpy(date_spec, str + am + 2, date_len);
- date_spec[date_len] = 0;
+ safe_strncpy(date_spec, str + am + 2, date_len + 1);
at_time = approxidate(date_spec);
free(date_spec);
len = am;