diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-02-18 07:27:46 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-02-18 07:27:46 +0000 |
commit | 2adca7c0a48708a84dd75d90fc5937fd09f53da8 (patch) | |
tree | c0489d84e39264206a04f99713cdea99c97e8429 | |
parent | 0d5df0a17249a0e0f2891b64a9e63ac19fe35d9d (diff) |
Use "tvb_get_string()" to get counted strings.
svn path=/trunk/; revision=10090
-rw-r--r-- | packet-postgresql.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/packet-postgresql.c b/packet-postgresql.c index f3ba73eb4a..b73a913656 100644 --- a/packet-postgresql.c +++ b/packet-postgresql.c @@ -3,7 +3,7 @@ * * Copyright 2004, Edwin Calo <calo@fusemail.com> * - * $Id: packet-postgresql.c,v 1.2 2004/02/17 10:03:47 jmayer Exp $ + * $Id: packet-postgresql.c,v 1.3 2004/02/18 07:27:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -94,9 +94,7 @@ dissect_postgresql (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) offset -= counter; /* Reading the string from the packet */ - string = g_malloc( counter+1 ); - tvb_memcpy(tvb,string,offset,counter); - string[counter]='\0'; /* Forcing end of string */ + string = tvb_get_string(tvb,offset,counter); /* Printing the data */ proto_tree_add_string (tree,hf_postgresql_string,tvb, offset,counter, string ); if (check_col (pinfo->cinfo, COL_INFO)) { col_append_fstr (pinfo->cinfo, COL_INFO, " %s", string ); } @@ -129,9 +127,7 @@ dissect_postgresql (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) if( counter > 1) { /* Reading the string from the packet */ - string = g_malloc( counter+1 ); - tvb_memcpy(tvb,string,offset,counter); - string[counter]='\0'; /* Forcing end of string */ + string = tvb_get_string(tvb,offset,counter); /* Printing the data */ proto_tree_add_string (tree,hf_postgresql_string,tvb, offset,counter, string ); if (check_col (pinfo->cinfo, COL_INFO)) { col_append_fstr (pinfo->cinfo, COL_INFO, " %s", string ); } |