summaryrefslogtreecommitdiffstats
path: root/usr.bin/tar/bsdtar.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2007-08-01 03:15:35 +0000
committerkientzle <kientzle@FreeBSD.org>2007-08-01 03:15:35 +0000
commitffbd95e6a799b3696864b727fa9e155561be64f4 (patch)
treed3d94645c0906c70ebe484e7ad4b11f043f67235 /usr.bin/tar/bsdtar.c
parentaa0911f2041ef5f70ebe1165b72029c30c030427 (diff)
downloadFreeBSD-src-ffbd95e6a799b3696864b727fa9e155561be64f4.zip
FreeBSD-src-ffbd95e6a799b3696864b727fa9e155561be64f4.tar.gz
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)
Diffstat (limited to 'usr.bin/tar/bsdtar.c')
-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 5ada551..03c6418 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
OpenPOWER on IntegriCloud