mirror of
https://github.com/opnsense/src.git
synced 2026-06-10 17:22:46 -04:00
Detect if argv[1] is "" and avoid calling malloc(0). Prior to this commit,
running 'tar ""' would print 'No memory' instead of the correct error message, 'Must specify one of -c, -r, -t, -u, -x' if malloc is set to System V mode (malloc(0) == NULL).
This commit is contained in:
parent
1eef28bb67
commit
2dc4c8e0e5
1 changed files with 2 additions and 2 deletions
|
|
@ -726,8 +726,8 @@ rewrite_argv(struct bsdtar *bsdtar, int *argc, char **src_argv,
|
|||
const char *p;
|
||||
char *src, *dest;
|
||||
|
||||
if (src_argv[0] == NULL ||
|
||||
src_argv[1] == NULL || src_argv[1][0] == '-')
|
||||
if (src_argv[0] == NULL || src_argv[1] == NULL ||
|
||||
src_argv[1][0] == '-' || src_argv[1][0] == '\0')
|
||||
return (src_argv);
|
||||
|
||||
*argc += strlen(src_argv[1]) - 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue