Hi,

I plan to push the attached patches in about a week unless there is
an objection.

Br,
Erik
>From 03894fd9ff0a4ff654220e57bf2a296c5a8e24a6 Mon Sep 17 00:00:00 2001
From: Erik Auerswald <auers...@unix-ag.uni-kl.de>
Date: Sat, 24 Aug 2024 23:57:16 +0200
Subject: [PATCH 1/2] tests: avoid spurious output from telnet tests

Avoid spurious output when manually running telnet-localhost.sh.
Standard output is already suppressed for the respective tests,
but suppressing output to standard error was overlooked.

* tests/telnet-localhost.sh: Redirect uninteresting error output
from parser regression tests to /dev/null.
---
 tests/telnet-localhost.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/telnet-localhost.sh b/tests/telnet-localhost.sh
index 400508ae..1e2728f2 100755
--- a/tests/telnet-localhost.sh
+++ b/tests/telnet-localhost.sh
@@ -105,7 +105,7 @@ fi
 
 # Check regression of crash reported here:
 # https://lists.gnu.org/archive/html/bug-inetutils/2022-02/msg00014.html
-echo 'help z ! ? z ! ? z ! ? z ! ? z ! ? z ! ? z !' | $TELNET > /dev/null
+echo 'help z ! ? z ! ? z ! ? z ! ? z ! ? z ! ? z !' | $TELNET > /dev/null 2>&1
 if test $? -ne 0; then
     echo "Regression of telnet crash bug." >&2
     exit 1
@@ -113,7 +113,7 @@ fi
 
 # Check regression of crash reported here:
 # https://lists.gnu.org/archive/html/bug-inetutils/2022-02/msg00009.html
-echo 'help help' | $TELNET > /dev/null
+echo 'help help' | $TELNET > /dev/null 2>&1
 if test $? -ne 0; then
     echo "Regression of telnet second crash bug." >&2
     exit 1
@@ -121,7 +121,7 @@ fi
 
 # Check regression of crash reported here:
 # https://lists.gnu.org/archive/html/bug-inetutils/2022-02/msg00007.html
-echo "unset ' '" | $TELNET > /dev/null
+echo "unset ' '" | $TELNET > /dev/null 2>&1
 if test $? -ne 0; then
     echo "Regression of telnet third crash bug." >&2
     exit 1
@@ -129,7 +129,7 @@ fi
 
 # Check regression of crash reported here:
 # https://lists.gnu.org/archive/html/bug-inetutils/2022-02/msg00010.html
-echo "set ' ' foo" | $TELNET > /dev/null
+echo "set ' ' foo" | $TELNET > /dev/null 2>&1
 if test $? -ne 0; then
     echo "Regression of telnet fourth crash bug." >&2
     exit 1
-- 
2.25.1

>From ba2a61100cfa87d106be33d34204ed8a2a8d52c7 Mon Sep 17 00:00:00 2001
From: Erik Auerswald <auers...@unix-ag.uni-kl.de>
Date: Sun, 25 Aug 2024 20:06:10 +0200
Subject: [PATCH 2/2] tests: check for regression of overflow fix

Commit a6d9848a32fafa763548e54b44cb094abdac915d fixed an
integer overflow when parsing a numerical value given to
the send do, send dont, send will, and send wont commands.
Check that overly large or small values are caught and
reported as 'bad value' even if they cannot be stored in
a 64-bit integer.

* tests/telnet-localhost.sh: New check to detect regressions
in the recent integer overflow fix.
---
 tests/telnet-localhost.sh | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/tests/telnet-localhost.sh b/tests/telnet-localhost.sh
index 1e2728f2..9c9a605a 100755
--- a/tests/telnet-localhost.sh
+++ b/tests/telnet-localhost.sh
@@ -135,6 +135,27 @@ if test $? -ne 0; then
     exit 1
 fi
 
+errno=0
+
+# In non-verbose mode the variables `display' and `display_err'
+# redirect output streams to `/dev/null'.
+
+test -n "${VERBOSE+yes}" || display='>/dev/null'
+test -n "${VERBOSE+yes}" || display_err='2>/dev/null'
+
+# Check regression of integer overflow check reported in:
+# https://lists.gnu.org/archive/html/bug-inetutils/2024-08/msg00007.html
+for value in -2147483649 -1 256 2147483648 9223372036854775808; do
+    for cmd in "do" "dont" "will" "wont"; do
+        output=`echo "send $cmd $value" | $TELNET 2>&1`
+        echo "$output" | eval "$GREP ': bad value ' $display"
+        if test $? -ne 0; then
+            errno=1
+            echo "Failed to catch bad value '$value'." >&2
+        fi
+    done
+done
+
 # Portability fix for SVR4
 PWD="${PWD:-`pwd`}"
 
@@ -191,13 +212,6 @@ fi
 
 # Must use '-d' consistently to prevent daemonizing, but we
 # would like to suppress the verbose output.
-#
-# In non-verbose mode the variables `display' and `display_err'
-# redirect output streams to `/dev/null'.
-
-test -n "${VERBOSE+yes}" || display='>/dev/null'
-test -n "${VERBOSE+yes}" || display_err='2>/dev/null'
-
 
 eval "$INETD -d -p'$INETD_PID' '$INETD_CONF' $display_err &"
 
@@ -221,8 +235,6 @@ test -z "$VERBOSE" || echo "Launched Inetd as process $inetd_pid." >&2
 
 telnet_opts="--no-rc --no-escape --no-login"
 
-errno=0
-
 if test "$TEST_IPV4" != "no" && test -n "$TARGET"; then
     output=`$TELNET $telnet_opts $TARGET $PORT 2>/dev/null`
     echo "$output" | eval "$GREP 'Your address is $TARGET.' $display"
-- 
2.25.1

Reply via email to