zfs, zpool: safe_malloc() duplicate argv
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13259
This commit is contained in:
parent
84a3eab6aa
commit
a3dcc0aa0c
|
@ -8697,7 +8697,7 @@ main(int argc, char **argv)
|
||||||
* Many commands modify input strings for string parsing reasons.
|
* Many commands modify input strings for string parsing reasons.
|
||||||
* We create a copy to protect the original argv.
|
* We create a copy to protect the original argv.
|
||||||
*/
|
*/
|
||||||
newargv = malloc((argc + 1) * sizeof (newargv[0]));
|
newargv = safe_malloc((argc + 1) * sizeof (newargv[0]));
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
newargv[i] = strdup(argv[i]);
|
newargv[i] = strdup(argv[i]);
|
||||||
newargv[argc] = NULL;
|
newargv[argc] = NULL;
|
||||||
|
|
|
@ -10924,7 +10924,7 @@ main(int argc, char **argv)
|
||||||
* Many commands modify input strings for string parsing reasons.
|
* Many commands modify input strings for string parsing reasons.
|
||||||
* We create a copy to protect the original argv.
|
* We create a copy to protect the original argv.
|
||||||
*/
|
*/
|
||||||
newargv = malloc((argc + 1) * sizeof (newargv[0]));
|
newargv = safe_malloc((argc + 1) * sizeof (newargv[0]));
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
newargv[i] = strdup(argv[i]);
|
newargv[i] = strdup(argv[i]);
|
||||||
newargv[argc] = NULL;
|
newargv[argc] = NULL;
|
||||||
|
|
Loading…
Reference in New Issue