summaryrefslogtreecommitdiff
path: root/ident.c
diff options
context:
space:
mode:
authorRafael Gieschke <rafael@gieschke.de>2011-05-16 20:08:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-05-18 04:27:19 (GMT)
commitc0336ff27a9a4bf9db87d65c5dec1ebf7dd9f8c6 (patch)
tree0a446ec6aa5b2e2f2a701c178ac6b3210c3311ae /ident.c
parent547e8b9205349b47003ed25a82673e413e71c255 (diff)
downloadgit-c0336ff27a9a4bf9db87d65c5dec1ebf7dd9f8c6.zip
git-c0336ff27a9a4bf9db87d65c5dec1ebf7dd9f8c6.tar.gz
git-c0336ff27a9a4bf9db87d65c5dec1ebf7dd9f8c6.tar.bz2
copy_gecos: fix not adding nlen to len when processing "&"
nlen has to be added to len when inserting (capitalized) pw_name as substitution for "&" in pw_gecos. Otherwise, pw_gecos will be truncated and data might be written beyond name+sz. Signed-off-by: Rafael Gieschke <rafael@gieschke.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ident.c')
-rw-r--r--ident.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ident.c b/ident.c
index 9e24388..4232084 100644
--- a/ident.c
+++ b/ident.c
@@ -34,6 +34,7 @@ static void copy_gecos(const struct passwd *w, char *name, size_t sz)
*dst++ = toupper(*w->pw_name);
memcpy(dst, w->pw_name + 1, nlen - 1);
dst += nlen - 1;
+ len += nlen;
}
}
if (len < sz)