mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
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:
10
main/utils.c
10
main/utils.c
@@ -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) {
|
||||
|
Reference in New Issue
Block a user