From 54beaf1a2b7faffcbfea7b30917986d9bed85492 Mon Sep 17 00:00:00 2001 From: Tee KOBAYASHI Date: Sat, 16 Apr 2022 15:09:14 +0900 Subject: [PATCH] natpmpc: Fix argc/argv off-by-one error --- packages/natpmpc/build.sh | 2 +- packages/natpmpc/natpmpc.c.patch | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 packages/natpmpc/natpmpc.c.patch diff --git a/packages/natpmpc/build.sh b/packages/natpmpc/build.sh index 459494969..3a70cce5b 100644 --- a/packages/natpmpc/build.sh +++ b/packages/natpmpc/build.sh @@ -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 diff --git a/packages/natpmpc/natpmpc.c.patch b/packages/natpmpc/natpmpc.c.patch new file mode 100644 index 000000000..3ffede765 --- /dev/null +++ b/packages/natpmpc/natpmpc.c.patch @@ -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; + }