From 691d83c5a94b199f5977835b9d442512104c44a7 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 14 Dec 2003 00:04:22 +0000 Subject: Use "tvb_format_text()" to format 8-bit strings, so we don't have problems with non-printable characters. Don't un-constify "tvb_get_ptr()". svn path=/trunk/; revision=9281 --- packet-gsm_sms.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'packet-gsm_sms.c') diff --git a/packet-gsm_sms.c b/packet-gsm_sms.c index 4f0bdef75c..8f8b27982c 100644 --- a/packet-gsm_sms.c +++ b/packet-gsm_sms.c @@ -11,7 +11,7 @@ * Technical realization of Short Message Service (SMS) * (3GPP TS 23.040 version 5.4.0 Release 5) * - * $Id: packet-gsm_sms.c,v 1.7 2003/12/13 23:55:29 guy Exp $ + * $Id: packet-gsm_sms.c,v 1.8 2003/12/14 00:04:22 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1389,10 +1389,10 @@ dis_field_fcs(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint8 oct) static int char_7bit_unpack(unsigned int offset, unsigned int in_length, unsigned int out_length, - unsigned char *input, unsigned char *output) + const guint8 *input, unsigned char *output) { unsigned char *out_num = output; /* Current pointer to the output buffer */ - unsigned char *in_num = input; /* Current pointer to the input buffer */ + const guint8 *in_num = input; /* Current pointer to the input buffer */ unsigned char rest = 0x00; int bits; @@ -1821,7 +1821,7 @@ dis_field_ud(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint32 length, gb { out_len = char_7bit_unpack(fill_bits, length, sizeof(bigbuf), - (guchar*) (tvb_get_ptr(tvb, offset, length)), bigbuf); + tvb_get_ptr(tvb, offset, length), bigbuf); bigbuf[out_len] = '\0'; char_ascii_decode(bigbuf, bigbuf, out_len); @@ -1829,8 +1829,8 @@ dis_field_ud(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint32 length, gb } else if (eight_bit) { - proto_tree_add_text(subtree, tvb, offset, length, "%.*s", - (int)length, tvb_get_ptr(tvb, offset, length)); + proto_tree_add_text(subtree, tvb, offset, length, "%s", + tvb_format_text(tvb, offset, length)); } else if (ucs2) { -- cgit v1.2.3