natpmpc: Fix argc/argv off-by-one error

This commit is contained in:
Tee KOBAYASHI 2022-04-16 15:09:14 +09:00 committed by xtkoba
parent 610e0da3c4
commit 54beaf1a2b
2 changed files with 21 additions and 1 deletions

View File

@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Portable and fully compliant implementation of NAT-PMP"
TERMUX_PKG_LICENSE="BSD 3-Clause"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=20150609
TERMUX_PKG_REVISION=2
TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL=http://miniupnp.free.fr/files/libnatpmp-$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=e1aa9c4c4219bc06943d6b2130f664daee213fb262fcb94dd355815b8f4536b0
TERMUX_PKG_BUILD_IN_SRC=true

View File

@ -0,0 +1,20 @@
--- a/natpmpc.c
+++ b/natpmpc.c
@@ -100,7 +100,7 @@
return 0;
case 'g':
forcegw = 1;
- if(argc < i + 1) {
+ if(!(argc > i + 1)) {
fprintf(stderr, "Not enough arguments for option -%c\n", argv[i][1]);
return 1;
}
@@ -108,7 +108,7 @@
break;
case 'a':
command = 'a';
- if(argc < i + 4) {
+ if(!(argc > i + 4)) {
fprintf(stderr, "Not enough arguments for option -%c\n", argv[i][1]);
return 1;
}