useradd: Fix buffer overflow when using a prefix
The buffer length did not count the string's trailing null byte. Signed-off-by: David Michael <fedora.dm0@gmail.com>
This commit is contained in:
parent
0336454503
commit
eaebea55a4
@ -2372,7 +2372,7 @@ static void create_mail (void)
|
|||||||
if (NULL == spool) {
|
if (NULL == spool) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
file = alloca (strlen (prefix) + strlen (spool) + strlen (user_name) + 2);
|
file = alloca (strlen (prefix) + strlen (spool) + strlen (user_name) + 3);
|
||||||
if (prefix[0])
|
if (prefix[0])
|
||||||
sprintf (file, "%s/%s/%s", prefix, spool, user_name);
|
sprintf (file, "%s/%s/%s", prefix, spool, user_name);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user