replace dangerous tvb_get_ptr with safer string function.

Using tvb_get_ptr to get a string is always dangerous in the face of
malformed packets. Instead using string functions allow for safe handling
of these.

Bug: 12242
Change-Id: I059c186032492aae9c90a69858ea3fc59e21313f
Reviewed-on: https://code.wireshark.org/review/14714
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Jaap Keuter 2016-03-30 23:52:26 +02:00 committed by Alexis La Goutte
parent 6ef16a85ac
commit ad097385c0
1 changed files with 2 additions and 2 deletions

View File

@ -435,7 +435,7 @@ dissect_pktc_rekey(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offs
/* Timestamp: YYMMDDhhmmssZ */
/* They really came up with a two-digit year in late 1990s! =8o */
timestr=tvb_get_ptr(tvb, offset, 13);
timestr=tvb_get_string_enc(wmem_packet_scope(), tvb, offset, 13, ENC_ASCII);
proto_tree_add_string_format_value(tree, hf_pktc_timestamp, tvb, offset, 13, timestr,
"%.2s-%.2s-%.2s %.2s:%.2s:%.2s",
timestr, timestr+2, timestr+4, timestr+6, timestr+8, timestr+10);
@ -672,7 +672,7 @@ proto_register_pktc(void)
"Server Kerberos Principal Identifier", "pktc.server_principal", FT_STRING, BASE_NONE,
NULL, 0, NULL, HFILL }},
{ &hf_pktc_timestamp, {
"Timestamp", "pktc.timestamp", FT_STRING, BASE_NONE,
"Timestamp", "pktc.timestamp", FT_STRING, STR_UNICODE,
NULL, 0, "Timestamp (UTC)", HFILL }},
{ &hf_pktc_app_spec_data, {
"Application Specific Data", "pktc.asd", FT_NONE, BASE_NONE,