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

@@ -265,6 +265,7 @@ enum ast_strsep_flags {
\param sep A single character delimiter.
\param flags Controls post-processing of the result.
AST_STRSEP_TRIM trims all leading and trailing whitespace from the result.
If the result containes only whitespace, it'll be passed through unchanged.
AST_STRSEP_STRIP does a trim then strips the outermost quotes. You may want
to trim again after the strip. Just OR both the TRIM and STRIP flags.
AST_STRSEP_UNESCAPE unescapes '\' sequences.