getfacl: Don't trust length of incoming user/groupname
Fixes Coverity CIDs 60079 and 60080 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
cf01b8f029
commit
7d5af6f0ba
@ -40,7 +40,7 @@ username (uid_t uid)
|
||||
struct passwd *pw;
|
||||
|
||||
if ((pw = getpwuid (uid)))
|
||||
strcpy (ubuf, pw->pw_name);
|
||||
snprintf (ubuf, sizeof ubuf, "%s", pw->pw_name);
|
||||
else
|
||||
sprintf (ubuf, "%lu <unknown>", (unsigned long)uid);
|
||||
return ubuf;
|
||||
@ -53,7 +53,7 @@ groupname (gid_t gid)
|
||||
struct group *gr;
|
||||
|
||||
if ((gr = getgrgid (gid)))
|
||||
strcpy (gbuf, gr->gr_name);
|
||||
snprintf (gbuf, sizeof gbuf, "%s", gr->gr_name);
|
||||
else
|
||||
sprintf (gbuf, "%lu <unknown>", (unsigned long)gid);
|
||||
return gbuf;
|
||||
|
Loading…
Reference in New Issue
Block a user