aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2019-11-18 14:02:58 +0100
committerAnders Broman <a.broman58@gmail.com>2019-11-18 14:06:44 +0000
commit93e0b019888b0a355e35c24b8c642ec1aa088021 (patch)
tree3d5a47715153766ea2d62a66211d448290e032c3
parent0468ead898743bf319b13fa0ad879d89d0ac0419 (diff)
SIP: Handle "Authorization:" Header without data.
Change-Id: I42f5ea5f2b0b12fc5cfe6df37b6cec5c85e1eb60 Reviewed-on: https://code.wireshark.org/review/35123 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-sip.c65
1 files changed, 34 insertions, 31 deletions
diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c
index a6f27b10bd..36fa949af5 100644
--- a/epan/dissectors/packet-sip.c
+++ b/epan/dissectors/packet-sip.c
@@ -4306,44 +4306,47 @@ dissect_sip_common(tvbuff_t *tvb, int offset, int remaining_length, packet_info
ENC_UTF_8|ENC_NA);
proto_item_set_hidden(ti_c);
- /* Authentication-Info does not begin with the scheme name */
- if (hf_index != POS_AUTHENTICATION_INFO)
- {
- /* The first time comma_offset is "start of parameters" */
- comma_offset = tvb_ws_mempbrk_pattern_guint8(tvb, value_offset, line_end_offset - value_offset, &pbrk_whitespace, NULL);
- proto_tree_add_item(sip_element_tree, hf_sip_auth_scheme,
- tvb, value_offset, comma_offset - value_offset,
- ENC_UTF_8|ENC_NA);
- }else{
- /* The first time comma_offset is "start of parameters" */
- comma_offset = value_offset;
- }
-
- /* Parse each individual parameter in the line */
- while ((comma_offset = dissect_sip_authorization_item(tvb, sip_element_tree, comma_offset, line_end_offset, &authorization_info)) != -1)
- {
- if(comma_offset == line_end_offset)
+ /* Check if we have any parameters */
+ if ((line_end_offset - value_offset) != 0) {
+ /* Authentication-Info does not begin with the scheme name */
+ if (hf_index != POS_AUTHENTICATION_INFO)
{
- /* Line End reached: Stop Parsing */
- break;
+ /* The first time comma_offset is "start of parameters" */
+ comma_offset = tvb_ws_mempbrk_pattern_guint8(tvb, value_offset, line_end_offset - value_offset, &pbrk_whitespace, NULL);
+ proto_tree_add_item(sip_element_tree, hf_sip_auth_scheme,
+ tvb, value_offset, comma_offset - value_offset,
+ ENC_UTF_8 | ENC_NA);
+ } else {
+ /* The first time comma_offset is "start of parameters" */
+ comma_offset = value_offset;
}
- if(tvb_get_guint8(tvb, comma_offset) != ',')
+ /* Parse each individual parameter in the line */
+ while ((comma_offset = dissect_sip_authorization_item(tvb, sip_element_tree, comma_offset, line_end_offset, &authorization_info)) != -1)
{
- /* Undefined value reached: Stop Parsing */
- break;
+ if (comma_offset == line_end_offset)
+ {
+ /* Line End reached: Stop Parsing */
+ break;
+ }
+
+ if (tvb_get_guint8(tvb, comma_offset) != ',')
+ {
+ /* Undefined value reached: Stop Parsing */
+ break;
+ }
+ comma_offset++; /* skip comma */
}
- comma_offset++; /* skip comma */
- }
- if ((authorization_info.response != NULL) && (global_sip_validate_authorization)) { /* If there is a response, check for valid credentials */
- authorization_user = sip_get_authorization(&authorization_info);
- if (authorization_user) {
- authorization_info.method = wmem_strdup(wmem_packet_scope(), stat_info->request_method);
- if (!sip_validate_authorization(&authorization_info, authorization_user->password)) {
- proto_tree_add_expert_format(tree, pinfo, &ei_sip_authorization_invalid, tvb, offset, line_end_offset - offset, "SIP digest does not match known password %s", authorization_user->password);
+ if ((authorization_info.response != NULL) && (global_sip_validate_authorization)) { /* If there is a response, check for valid credentials */
+ authorization_user = sip_get_authorization(&authorization_info);
+ if (authorization_user) {
+ authorization_info.method = wmem_strdup(wmem_packet_scope(), stat_info->request_method);
+ if (!sip_validate_authorization(&authorization_info, authorization_user->password)) {
+ proto_tree_add_expert_format(tree, pinfo, &ei_sip_authorization_invalid, tvb, offset, line_end_offset - offset, "SIP digest does not match known password %s", authorization_user->password);
+ }
}
}
- }
+ } /* Check if we have any parameters */
}/*hdr_tree*/
break;