summaryrefslogtreecommitdiff
path: root/nDPId.c
diff options
context:
space:
mode:
authorlns <matzeton@googlemail.com>2022-08-08 09:33:26 +0200
committerlns <matzeton@googlemail.com>2022-08-08 09:33:26 +0200
commitae37631e23ebcac770e7019bf2e95afc7c959674 (patch)
treec0c075e8aea41a07f829e15766b99d636d0cc1ff /nDPId.c
parentef94b83a62b4d1c7cefd8982f0bcadfc0b1f097c (diff)
Do not SIGSEGV if a subopt has no value.
Signed-off-by: lns <matzeton@googlemail.com>
Diffstat (limited to 'nDPId.c')
-rw-r--r--nDPId.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/nDPId.c b/nDPId.c
index d034ecaa2..85b665bc1 100644
--- a/nDPId.c
+++ b/nDPId.c
@@ -4459,6 +4459,14 @@ static int nDPId_parse_options(int argc, char ** argv)
{
char * endptr;
int subopt = getsubopt(&subopts, subopt_token, &value);
+ if (value == NULL && subopt != -1)
+ {
+ logger_early(1, "Missing value for `%s'", subopt_token[subopt]);
+ fprintf(stderr, "%s", "\n");
+ fprintf(stderr, usage, argv[0]);
+ print_subopt_usage();
+ return 1;
+ }
if (subopt == -1)
{
logger_early(1, "Invalid subopt: %s", value);