mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +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:
@@ -498,6 +498,7 @@ static struct ast_variable *var_list_from_loc_info(struct ast_xml_node *locinfo,
|
||||
enum ast_geoloc_format format, const char *ref_str)
|
||||
{
|
||||
struct ast_variable *list = NULL;
|
||||
struct ast_variable *locinfo_list = NULL;
|
||||
struct ast_xml_node *container;
|
||||
struct ast_variable *var = NULL;
|
||||
const char *attr;
|
||||
@@ -531,7 +532,12 @@ static struct ast_variable *var_list_from_loc_info(struct ast_xml_node *locinfo,
|
||||
ast_variable_list_append(&list, var);
|
||||
}
|
||||
|
||||
ast_variable_list_append(&list, var_list_from_node(container, ref_str));
|
||||
locinfo_list = var_list_from_node(container, ref_str);
|
||||
if (locinfo_list == NULL) {
|
||||
ast_log(LOG_WARNING, "%s: There were no elements in the location info\n", ref_str);
|
||||
SCOPE_EXIT_RTN_VALUE(list, "%s: There were no elements in the location info\n", ref_str);
|
||||
}
|
||||
ast_variable_list_append(&list, locinfo_list);
|
||||
|
||||
if (TRACE_ATLEAST(5)) {
|
||||
struct ast_str *buf = NULL;
|
||||
|
Reference in New Issue
Block a user