[Asterisk-code-review] conversions.c: Specify that we only want to parse decimal numbers. (asterisk[18])

Sean Bright asteriskteam at digium.com
Fri Mar 4 14:30:31 CST 2022


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/18202 )


Change subject: conversions.c: Specify that we only want to parse decimal numbers.
......................................................................

conversions.c: Specify that we only want to parse decimal numbers.

Passing 0 as the last argument to strtoimax() or strtoumax() causes
octal and hexadecimal to be accepted which was not originally
intended. So we now force to only accept decimal.

ASTERISK-29950 #close

Change-Id: I93baf0f273441e8280354630a463df263a8c0edd
---
M main/conversions.c
1 file changed, 2 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/02/18202/1

diff --git a/main/conversions.c b/main/conversions.c
index 007e24d..4b58140 100644
--- a/main/conversions.c
+++ b/main/conversions.c
@@ -99,7 +99,7 @@
 	}
 
 	errno = 0;
-	val = strtoimax(str, &end, 0);
+	val = strtoimax(str, &end, 10);
 
 	/*
 	 * If str equals end then no digits were found. If end is not pointing to
@@ -126,7 +126,7 @@
 	}
 
 	errno = 0;
-	val = strtoumax(str, &end, 0);
+	val = strtoumax(str, &end, 10);
 
 	/*
 	 * If str equals end then no digits were found. If end is not pointing to

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

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I93baf0f273441e8280354630a463df263a8c0edd
Gerrit-Change-Number: 18202
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean at seanbright.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220304/994a4427/attachment.html>


More information about the asterisk-code-review mailing list