Change in libosmocore[master]: vty: Allow larger strlen parsing numerical range values

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Jul 28 15:55:32 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/19423 )


Change subject: vty: Allow larger strlen parsing numerical range values
......................................................................

vty: Allow larger strlen parsing numerical range values

This allows for instance accepting a range:
<0x00-0xffffffffffffffff>, which is a 64bit mask.

Change-Id: Id053acd6bf5e8fb7c468959f0b78b778f8c5e6c2
---
M src/vty/command.c
1 file changed, 6 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/23/19423/1

diff --git a/src/vty/command.c b/src/vty/command.c
index 256f1db..cc52c14 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -1262,12 +1262,12 @@
 
 #endif				/* HAVE_IPV6  */
 
-#define DECIMAL_STRLEN_MAX 10
+#define NUMERIC_STRLEN_MAX 18
 
 static int cmd_range_match(const char *range, const char *str)
 {
 	char *p;
-	char buf[DECIMAL_STRLEN_MAX + 1];
+	char buf[NUMERIC_STRLEN_MAX + 1];
 	char *endptr = NULL;
 
 	if (str == NULL)
@@ -1284,7 +1284,7 @@
 		p = strchr(range, '-');
 		if (p == NULL)
 			return 0;
-		if (p - range > DECIMAL_STRLEN_MAX)
+		if (p - range > NUMERIC_STRLEN_MAX)
 			return 0;
 		strncpy(buf, range, p - range);
 		buf[p - range] = '\0';
@@ -1296,7 +1296,7 @@
 		p = strchr(range, '>');
 		if (p == NULL)
 			return 0;
-		if (p - range > DECIMAL_STRLEN_MAX)
+		if (p - range > NUMERIC_STRLEN_MAX)
 			return 0;
 		strncpy(buf, range, p - range);
 		buf[p - range] = '\0';
@@ -1317,7 +1317,7 @@
 		p = strchr(range, '-');
 		if (p == NULL)
 			return 0;
-		if (p - range > DECIMAL_STRLEN_MAX)
+		if (p - range > NUMERIC_STRLEN_MAX)
 			return 0;
 		strncpy(buf, range, p - range);
 		buf[p - range] = '\0';
@@ -1329,7 +1329,7 @@
 		p = strchr(range, '>');
 		if (p == NULL)
 			return 0;
-		if (p - range > DECIMAL_STRLEN_MAX)
+		if (p - range > NUMERIC_STRLEN_MAX)
 			return 0;
 		strncpy(buf, range, p - range);
 		buf[p - range] = '\0';

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/19423
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Id053acd6bf5e8fb7c468959f0b78b778f8c5e6c2
Gerrit-Change-Number: 19423
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200728/c88b81a1/attachment.htm>


More information about the gerrit-log mailing list