res_geolocation: Fix segfault when there's an empty element

Fixed a segfault caused by var_list_from_loc_info() encountering
an empty location info element.

Fixed an issue in ast_strsep() where a value with only whitespace
wasn't being preserved.

Fixed an issue in ast_variable_list_from_quoted_string() where
an empty value was considered a failure.

ASTERISK-30215
Reported by: Dan Cropp

Change-Id: Ieca64e061a6d9298f0196c694b60d986ef82613a
This commit is contained in:
George Joseph
2022-09-13 07:14:37 -06:00
parent 80bc844fd6
commit 8cbea1c7ef
5 changed files with 23 additions and 13 deletions

View File

@@ -1849,7 +1849,10 @@ char *ast_strsep(char **iss, const char sep, uint32_t flags)
}
if (flags & AST_STRSEP_TRIM) {
st = ast_strip(st);
char *trimmed = ast_strip(st);
if (!ast_strlen_zero(trimmed)) {
st = trimmed;
}
}
if (flags & AST_STRSEP_UNESCAPE) {
@@ -1910,7 +1913,10 @@ char *ast_strsep_quoted(char **iss, const char sep, const char quote, uint32_t f
}
if (flags & AST_STRSEP_TRIM) {
st = ast_strip(st);
char *trimmed = ast_strip(st);
if (!ast_strlen_zero(trimmed)) {
st = trimmed;
}
}
if (flags & AST_STRSEP_UNESCAPE) {