aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-12-14 00:04:22 +0000
committerGuy Harris <guy@alum.mit.edu>2003-12-14 00:04:22 +0000
commit691d83c5a94b199f5977835b9d442512104c44a7 (patch)
tree3576e91431534504490ed024a682e71dbad0d6bd
parent4b21d5e882b22d627a801e5e535e1a1fdd795557 (diff)
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
-rw-r--r--packet-gsm_sms.c12
1 files changed, 6 insertions, 6 deletions
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 <gerald@ethereal.com>
@@ -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)
{