Use non-exiting allocatings in the sudoers plugin.

This commit is contained in:
Todd C. Miller
2015-06-17 06:49:59 -06:00
parent 6da04821d7
commit d004b02fc6
36 changed files with 1073 additions and 810 deletions

View File

@@ -78,7 +78,11 @@ linux_audit_command(char *argv[], int result)
/* Convert argv to a flat string. */
for (size = 0, av = argv; *av != NULL; av++)
size += strlen(*av) + 1;
command = cp = sudo_emalloc(size);
command = cp = malloc(size);
if (command == NULL) {
sudo_warn(U_("unable to allocate memory"));
goto done;
}
for (av = argv; *av != NULL; av++) {
n = strlcpy(cp, *av, size - (cp - command));
if (n >= size - (cp - command)) {
@@ -101,7 +105,7 @@ linux_audit_command(char *argv[], int result)
rc = 0;
done:
sudo_efree(command);
free(command);
debug_return_int(rc);
}