INN commit: trunk/innd (cc.c)

INN Commit rra at isc.org
Fri Dec 18 20:44:27 UTC 2020


    Date: Friday, December 18, 2020 @ 12:44:27
  Author: iulius
Revision: 10455

innd/cc.c:  Check the syntax of the "ctlinnd name" command

Check that the argument to "ctlinnd name" is either empty or a number.
Correctly return a "Bad channel number" error instead of "free:-1".

Modified:
  trunk/innd/cc.c

------+
 cc.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Modified: cc.c
===================================================================
--- cc.c	2020-12-18 20:41:51 UTC (rev 10454)
+++ cc.c	2020-12-18 20:44:27 UTC (rev 10455)
@@ -924,11 +924,18 @@
     CHANNEL *cp;
     int i, count;
     const char *mode;
+    char *p;
 
     if (av[0][0] != '\0') {
+        for (p = av[0]; *p != '\0'; p++) {
+            if (!isdigit((unsigned char) *p)) {
+                return "1 Bad channel number";
+            }
+        }
         cp = CHANfromdescriptor(atoi(av[0]));
-        if (cp == NULL)
+        if (cp == NULL || cp->Type == CTfree) {
             return xstrdup(CCnochannel);
+        }
         buffer_sprintf(&CCreply, "0 %s", CHANname(cp));
 	return CCreply.data;
     }



More information about the inn-committers mailing list