From b44ab26b2847ede8650a6661220868ad2369d8db Mon Sep 17 00:00:00 2001 From: Self-Hosting-Group <155233284+Self-Hosting-Group@users.noreply.github.com> Date: Mon, 8 Jan 2024 20:32:55 +0100 Subject: [PATCH] upnpc: Fix and complete check of the number of options required --- miniupnpc/src/upnpc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/miniupnpc/src/upnpc.c b/miniupnpc/src/upnpc.c index 2c65f28..fc41bf0 100644 --- a/miniupnpc/src/upnpc.c +++ b/miniupnpc/src/upnpc.c @@ -652,11 +652,16 @@ int main(int argc, char ** argv) if(!command || (command == 'a' && commandargc<4) - || (command == 'd' && argc<2) - || (command == 'r' && argc<2) + || (command == 'r' && commandargc<2) || (command == 'A' && commandargc<6) + || (command == 'd' && commandargc<2) + || (command == 'D' && commandargc<1) + || (command == 'n' && commandargc<4) + || (command == 'N' && commandargc<3) || (command == 'U' && commandargc<2) - || (command == 'D' && commandargc<1)) + || (command == 'K' && commandargc<1) + || (command == 'C' && commandargc<1) + || (command == 'G' && commandargc<5)) { fprintf(stderr, "Usage:\n"); fprintf(stderr, " %s [options] -a ip port external_port protocol [duration] [remote host]\n Add port mapping\n", argv[0]);