voicecall: Drop unused GError variables
PATCH 1/4 voicecall: Drop unused GError variables
GError return variables would possibly be allocated by g_key_file_get_* functions, but never used and never freed. Fix that.
--- src/voicecall.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
src/voicecall.c +2 -4
@@ -3438,10 +3438,9 @@ static void emulator_dial_callback(const struct ofono_error *error, void *data)gboolean need_to_emit;struct voicecall *v;char *number; -GError *err =NULL ; number =g_key_file_get_string (vc->settings,SETTINGS_GROUP , -"Number" , &err); +"Number" ,NULL ); v =dial_handle_result (vc, error, number, &need_to_emit);
@@ -3564,7 +3563,6 @@ static void emulator_bldn_cb(struct ofono_emulator *em,struct ofono_voicecall *vc = userdata;char *number =NULL ;struct ofono_error result; -GError *error =NULL ;switch (ofono_emulator_request_get_type (req)) {case OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY :
@@ -3572,7 +3570,7 @@ static void emulator_bldn_cb(struct ofono_emulator *em, goto fail; number =g_key_file_get_string (vc->settings,SETTINGS_GROUP , -"Number" , &error); +"Number" ,NULL );if (number ==NULL || number[0 ] =='\0' ) goto fail;
Signature · 1 line
2.43.0
PATCH 2/4 smsutil: ensure the address length in bytes <= 10
If a specially formatted SMS is received, it is conceivable that the address length might overflow the structure it is being parsed into. Ensure that the length in bytes of the address never exceeds 10.
--- src/smsutil.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
src/smsutil.c +6 -1
@@ -643,7 +643,12 @@ gboolean sms_decode_address_field(const unsigned char *pdu, int len,else byte_len = (addr_len +1 ) /2 ; -if ((len - *offset) < byte_len) +/* +* 23.040: +* The maximum length of the full address field +* (AddressLength, TypeofAddress and AddressValue) is 12 octets. +*/ +if ((len - *offset) < byte_len || byte_len >10 )return FALSE; out->number_type =bit_field (addr_type,4 ,3 );
Signature · 1 line
2.43.0
PATCH 3/4 smsutil: Check cbs_dcs_decode return value
In reply to Denis KenziorIt is better to explicitly check the return value of cbs_dcs_decode instead of relying on udhi not being changed due to side-effects.
--- src/smsutil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
src/smsutil.c +2 -1
@@ -1765,7 +1765,8 @@ gboolean sms_udh_iter_init_from_cbs(const struct cbs *cbs,const guint8 *hdr;guint8 max_ud_len; -cbs_dcs_decode (cbs->dcs, &udhi,NULL ,NULL ,NULL ,NULL ,NULL ); +if (!cbs_dcs_decode (cbs->dcs, &udhi,NULL ,NULL ,NULL ,NULL ,NULL )) +return FALSE;if (!udhi)return FALSE;
Signature · 1 line
2.43.0
PATCH 4/4 simutil: Make sure set_length on the parent succeeds
In reply to Denis Kenzior--- src/simutil.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
src/simutil.c +6 -5
@@ -588,8 +588,9 @@ gboolean ber_tlv_builder_set_length(struct ber_tlv_builder *builder,if (new_pos > builder->max)return FALSE; -if (builder->parent) -ber_tlv_builder_set_length (builder->parent, new_pos); +if (builder->parent && + !ber_tlv_builder_set_length (builder->parent, new_pos)) +return FALSE; builder->len = new_len;
@@ -730,9 +731,9 @@ gboolean comprehension_tlv_builder_set_length(if (builder->pos + new_ctlv_len > builder->max)return FALSE; -if (builder->parent) -ber_tlv_builder_set_length (builder->parent, - builder->pos + new_ctlv_len); +if (builder->parent && !ber_tlv_builder_set_length (builder->parent, + builder->pos + new_ctlv_len)) +return FALSE; len =MIN (builder->len, new_len);if (len >0 && new_len_size != len_size)
Signature · 1 line
2.43.0
This series was applied to ofono.git (master) by Denis Kenzior <[email protected]>:
Hello:
This series was applied to ofono.git (master)
by Denis Kenzior <[email protected]>:
Quoted 5 lines · On Thu, 29 Feb 2024 12:07:33 -0600 you wrote:
GError return variables would possibly be allocated by g_key_file_get_* functions, but never used and never freed. Fix that.
--- src/voicecall.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Here is the summary with links:
- [1/4] voicecall: Drop unused GError variables
https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=8165dc6c175f - [2/4] smsutil: ensure the address length in bytes <= 10 https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=a90421d8e45d - [3/4] smsutil: Check cbs_dcs_decode return value https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=7f2adfa22fba - [4/4] simutil: Make sure set_length on the parent succeeds https://git.kernel.org/pub/scm/network/ofono/ofono.git/?id=07f48b23e387
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html