Use *array() allocation functions where appropriate

This prevents overflow from multiplication.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2023-02-23 20:28:43 -06:00
committed by Serge Hallyn
parent 727275a027
commit 191f04f7dc
18 changed files with 26 additions and 26 deletions
+3 -3
View File
@@ -1200,9 +1200,9 @@ int main (int argc, char **argv)
#ifdef USE_PAM
/* keep the list of user/password for later update by PAM */
nusers++;
lines = reallocf (lines, sizeof (lines[0]) * nusers);
usernames = reallocf (usernames, sizeof (usernames[0]) * nusers);
passwords = reallocf (passwords, sizeof (passwords[0]) * nusers);
lines = reallocf (lines, nusers, sizeof (lines[0]));
usernames = reallocf (usernames, nusers, sizeof (usernames[0]));
passwords = reallocf (passwords, nusers, sizeof (passwords[0]));
if (lines == NULL || usernames == NULL || passwords == NULL) {
fprintf (stderr,
_("%s: line %d: %s\n"),