aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMike Duigou <bondolo@dev.java.net>2007-09-28 18:23:59 +0000
committerMike Duigou <bondolo@dev.java.net>2007-09-28 18:23:59 +0000
commit6aeb75c3f0f3f689a70f482bf300b4ff74fa64c3 (patch)
tree22620f996d5cc4920d94cf540d83144581bb4686 /epan
parentf4e9824c46e92ed66e8599048f5c12370726fabc (diff)
Changes get_addr_name_buf() to use the more common convention where the provided buffer size is the entire size of the buffer including the space for the terminating \0
svn path=/trunk/; revision=23016
Diffstat (limited to 'epan')
-rw-r--r--epan/addr_resolv.c9
-rw-r--r--epan/addr_resolv.h6
-rw-r--r--epan/column-utils.c2
3 files changed, 6 insertions, 11 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index c0eac46157..b19ed043f7 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -2132,14 +2132,9 @@ const gchar *get_addr_name(address *addr)
void get_addr_name_buf(address *addr, gchar *buf, guint size)
{
- const gchar *result;
-
- result = get_addr_name(addr);
-
- strncpy(buf,result,size);
- buf[size]='\0';
- return;
+ const gchar *result = get_addr_name(addr);
+ g_snprintf(buf, size, "%s", result);
} /* get_addr_name_buf */
diff --git a/epan/addr_resolv.h b/epan/addr_resolv.h
index ca23252e77..424e37ebe3 100644
--- a/epan/addr_resolv.h
+++ b/epan/addr_resolv.h
@@ -109,9 +109,9 @@ extern gchar *get_sctp_port(guint port);
const gchar *get_addr_name(address *addr);
/* get_addr_name_buf solves an address in the same way as get_addr_name above */
-/* The difference is that get_addr_name_buf takes as input a buffer, in which it puts */
-/* the result, and a maximum string length -size-. the buffer should be large enough to */
-/* contain size characters plus the terminator */
+/* The difference is that get_addr_name_buf takes as input a buffer, into which it puts */
+/* the result which is always NUL ('\0') terminated. The buffer should be large enough to */
+/* contain size characters including the terminator */
void get_addr_name_buf(address *addr, gchar *buf, guint size);
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 2e6d58b197..1c669c3806 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -922,7 +922,7 @@ col_set_addr(packet_info *pinfo, int col, address *addr, gboolean is_res,
return; /* no address, nothing to do */
if (is_res) {
- get_addr_name_buf(addr, pinfo->cinfo->col_buf[col],COL_MAX_LEN-1);
+ get_addr_name_buf(addr, pinfo->cinfo->col_buf[col],COL_MAX_LEN);
} else {
switch (addr->type) {