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
This commit is contained in:
Sean Bright
2022-03-04 15:26:22 -05:00
committed by Friendly Automation
parent 309c8da206
commit 2dce4f6579
2 changed files with 14 additions and 2 deletions

View File

@@ -99,7 +99,7 @@ int ast_str_to_imax(const char *str, intmax_t *res)
}
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 @@ int ast_str_to_umax(const char *str, uintmax_t *res)
}
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