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:
@@ -1961,13 +1961,13 @@ AST_TEST_DEFINE(variable_list_from_string)
|
||||
break;
|
||||
}
|
||||
|
||||
parse_string = "abc = 'def', ghi = 'j,kl', mno='pq=r', stu = 'vwx=\"yz\", ABC = \"DEF\"'";
|
||||
parse_string = "000= '', 111=, 222 = , 333 = ' ', abc = 'def', ghi = 'j,kl', mno='pq=r', stu = 'vwx=\"yz\", ABC = \"DEF\"'";
|
||||
list = ast_variable_list_from_quoted_string(parse_string, ",", "=", "'");
|
||||
ast_test_validate(test, list != NULL);
|
||||
str = ast_variable_list_join(list, "|", "^", "@", NULL);
|
||||
|
||||
ast_test_validate(test,
|
||||
strcmp(ast_str_buffer(str), "abc^@def@|ghi^@j,kl@|mno^@pq=r@|stu^@vwx=\"yz\", ABC = \"DEF\"@") == 0);
|
||||
strcmp(ast_str_buffer(str), "000^@@|111^@@|222^@@|333^@ @|abc^@def@|ghi^@j,kl@|mno^@pq=r@|stu^@vwx=\"yz\", ABC = \"DEF\"@") == 0);
|
||||
|
||||
return AST_TEST_PASS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user