Skip to content

Commit

Permalink
MS-MMS: Use format_text_string()
Browse files Browse the repository at this point in the history
The length of a string transcoded from UTF-16 to UTF-8 can be
shorter (or longer) than the original length in bytes in the packet.
Use the new string length, not the original length.

Use format_text_string, which is a convenience function that
calls strlen.

Fix #19086
  • Loading branch information
johnthacker committed May 19, 2023
1 parent c76ec1e commit 1c45a89
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions epan/dissectors/packet-ms-mms.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ static void dissect_client_transport_info(tvbuff_t *tvb, packet_info *pinfo, pro
transport_info, "Transport: (%s)", transport_info);

col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)",
format_text(pinfo->pool, (guchar*)transport_info, length_remaining - 20));
format_text_string(pinfo->pool, (const guchar*)transport_info));


/* Try to extract details from this string */
Expand Down Expand Up @@ -837,7 +837,7 @@ static void dissect_server_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
ENC_UTF_16|ENC_LITTLE_ENDIAN, pinfo->pool, &server_version);

col_append_fstr(pinfo->cinfo, COL_INFO, " (version='%s')",
format_text(pinfo->pool, (const guchar*)server_version, strlen(server_version)));
format_text_string(pinfo->pool, (const guchar*)server_version));
}
offset += (server_version_length*2);

Expand Down Expand Up @@ -891,7 +891,7 @@ static void dissect_client_player_info(tvbuff_t *tvb, packet_info *pinfo, proto_
ENC_UTF_16|ENC_LITTLE_ENDIAN, pinfo->pool, &player_info);

col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)",
format_text(pinfo->pool, (const guchar*)player_info, strlen(player_info)));
format_text_string(pinfo->pool, (const guchar*)player_info));
}

/* Dissect info about where client wants to start playing from */
Expand Down Expand Up @@ -966,7 +966,7 @@ static void dissect_request_server_file(tvbuff_t *tvb, packet_info *pinfo, proto
ENC_UTF_16|ENC_LITTLE_ENDIAN, pinfo->pool, &server_file);

col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)",
format_text(pinfo->pool, (const guchar*)server_file, strlen(server_file)));
format_text_string(pinfo->pool, (const guchar*)server_file));
}

/* Dissect media details from server */
Expand Down

0 comments on commit 1c45a89

Please sign in to comment.