提交 c0336ff2 编写于 作者: R Rafael Gieschke 提交者: Junio C Hamano

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: NRafael Gieschke <rafael@gieschke.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 547e8b92
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册