Change in libosmocore[master]: vty: Don't match negative values on purely positive ranges

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/+/19424 )


Change subject: vty: Don't match negative values on purely positive ranges
......................................................................

vty: Don't match negative values on purely positive ranges

Without this patch, for instance having a range 0-ULONG_MAX would match
if someones types value -3, which would be converted to unsigned but
that's clearly what is expected here from user point of view.

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



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/24/19424/1

diff --git a/src/vty/command.c b/src/vty/command.c
index cc52c14..7522c1d 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -1309,6 +1309,9 @@
 	} else {
 		unsigned long min, max, val;
 
+		if (str[0] == '-')
+			return 0;
+
 		val = strtoul(str, &endptr, 0);
 		if (*endptr != '\0')
 			return 0;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ia95f6314a2dd3f94d21fc219cf69bb8d39b8e7f0
Gerrit-Change-Number: 19424
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/92d66a39/attachment.htm>


More information about the gerrit-log mailing list