From 09ec2abf6e2687aff431c5a2bb4f29b08a07c060 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 7 Oct 2024 09:08:42 -0400 Subject: [PATCH] MT#55283 use correct type in argument These functions expect a `rtpp_pos` argument, and while `str` is compatible through the union, it lacks the second member of the struct, which ends up uninitialised. Use the correct type through temporary objects instead. Change-Id: I0c553bdbb31c351346746b6072f2d424113bac5a --- daemon/control_ng_flags_parser.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/daemon/control_ng_flags_parser.c b/daemon/control_ng_flags_parser.c index 620eaff4f..539955958 100644 --- a/daemon/control_ng_flags_parser.c +++ b/daemon/control_ng_flags_parser.c @@ -74,8 +74,8 @@ static inline void skip_chars(str *s, char c) { while (skip_char(s, c)); } -static int rtpp_is_dict_list(str *a) { - str list = *a; +static int rtpp_is_dict_list(rtpp_pos *a) { + str list = a->cur; if (!skip_char(&list, '[')) return 0; // check contents @@ -93,13 +93,13 @@ static int rtpp_is_dict_list(str *a) { } static bool rtpp_is_list(rtpp_pos *a) { - return rtpp_is_dict_list(&a->cur) == 1; + return rtpp_is_dict_list(a) == 1; } static bool rtpp_is_dict(rtpp_pos *a) { - return rtpp_is_dict_list(&a->cur) == 2; + return rtpp_is_dict_list(a) == 2; } static str *rtpp_get_str(rtpp_pos *a, str *b) { - if (rtpp_is_dict_list(&a->cur) != 0) + if (rtpp_is_dict_list(a) != 0) return NULL; if (a->cur.len == 0) return NULL; @@ -260,7 +260,7 @@ static bool parse_codec_to_dict(str * key, str * val, const char *cmp1, const ch return false; } - call_ng_codec_flags(&dummy_parser, STR_PTR(dictstr), &s, flags); + call_ng_codec_flags(&dummy_parser, STR_PTR(dictstr), &(rtpp_pos) {.cur = s}, flags); return true; } @@ -294,7 +294,7 @@ static void parse_transports(unsigned int transport, sdp_ng_flags *out) const char * val = transports[transport & 0x007]; if (!val) return; - call_ng_main_flags(&dummy_parser, &STR_CONST("transport-protocol"), STR_PTR(val), out); + call_ng_main_flags(&dummy_parser, &STR_CONST("transport-protocol"), &(rtpp_pos) {.cur = STR(val)}, out); } @@ -305,7 +305,7 @@ static void rtpp_direction_flag(sdp_ng_flags *flags, unsigned int *flagnum, str return; } str key = keys[(*flagnum)++]; - call_ng_main_flags(&dummy_parser, &key, val, flags); + call_ng_main_flags(&dummy_parser, &key, &(rtpp_pos) {.cur = *val}, flags); } /** @@ -399,7 +399,7 @@ void parse_rtpp_flags(const str * rtpp_flags, sdp_ng_flags *out) if (!val.s && str_eq(&key, "RTP/SAVPF")) transport = 0x103; /* direction */ - else if (str_eq(&key, "direction") && rtpp_is_dict_list(&val) == 0) + else if (str_eq(&key, "direction") && rtpp_is_dict_list(&(rtpp_pos) {.cur=val}) == 0) rtpp_direction_flag(out, &direction_flag, &val); else goto generic;