aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/tar
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@FreeBSD.org>2007-08-01 03:15:35 +0000
committerTim Kientzle <kientzle@FreeBSD.org>2007-08-01 03:15:35 +0000
commit9b93c30d30e9f8113aef5b30951a21e3c494e81c (patch)
treed3d94645c0906c70ebe484e7ad4b11f043f67235 /usr.bin/tar
parent85ce7297942f027d8f3ea617c14842af5ec63db7 (diff)
downloadsrc-9b93c30d30e9f8113aef5b30951a21e3c494e81c.tar.gz
src-9b93c30d30e9f8113aef5b30951a21e3c494e81c.zip
Fix for PR bin/115033. This corrects a crash when long options
are specified with the "-W option=arg" syntax and the '=' is omitted. MFC after: 3 days Approved by: re (rwatson)
Notes
Notes: svn path=/head/; revision=171679
Diffstat (limited to 'usr.bin/tar')
-rw-r--r--usr.bin/tar/bsdtar.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/usr.bin/tar/bsdtar.c b/usr.bin/tar/bsdtar.c
index 5ada5518ca68..03c64182a66c 100644
--- a/usr.bin/tar/bsdtar.c
+++ b/usr.bin/tar/bsdtar.c
@@ -911,6 +911,10 @@ bsdtar_getopt(struct bsdtar *bsdtar, const char *optstring,
"(matches both %s and %s)",
p, (*poption)->name, option->name);
+ if ((*poption)->has_arg == required_argument
+ && optarg == NULL)
+ bsdtar_errc(bsdtar, 1, 0,
+ "Option \"%s\" requires argument", p);
} else {
opt = '?';
/* TODO: Set up a fake 'struct option' for