Fix & expansion (from pw_gecos field), sizeof buf used when

buf is pointer, not array, buflen must be used instead.
Charlie & from root name was expanded to junk as result.
This commit is contained in:
Andrey A. Chernov 1996-09-21 23:37:35 +00:00
parent f98e6287f8
commit c0eb19c55f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=18451

View file

@ -418,7 +418,7 @@ buildfname(gecos, login, buf, buflen)
{
if (*p == '&')
{
snprintf(bp, SPACELEFT(buf, bp), "%s", login);
snprintf(bp, buflen - (bp - buf), "%s", login);
*bp = toupper(*bp);
bp += strlen(bp);
}