aboutsummaryrefslogtreecommitdiffstats
path: root/epan/to_str.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2009-12-08 10:17:37 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2009-12-08 10:17:37 +0000
commitd71b1088f7f606de416019df86d888c4e53e1c5b (patch)
treeacb085e901b03d36ecc7ccdbaa825e0787858312 /epan/to_str.c
parent7885ac7b92b01c1df4f34e586fca12da4434c139 (diff)
From Jakub Zawadzki:
Fix win64 build. svn path=/trunk/; revision=31204
Diffstat (limited to 'epan/to_str.c')
-rw-r--r--epan/to_str.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/epan/to_str.c b/epan/to_str.c
index 9deac0ae04..f430554e33 100644
--- a/epan/to_str.c
+++ b/epan/to_str.c
@@ -1108,13 +1108,13 @@ address_to_str_buf(const address *addr, gchar *buf, int buf_len)
}
/* copy to output buffer */
- *tempptr = '\0';
- if (temp[0]) {
- int temp_len = (tempptr - temp) + 1;
+ if (tempptr != temp) {
+ size_t temp_len = (size_t) (tempptr - temp);
- if (temp_len <= buf_len)
- g_strlcpy(buf, temp, buf_len); /* memcpy(), strcpy() ? */
- else
+ if (temp_len < (size_t) buf_len) {
+ memcpy(buf, temp, temp_len);
+ buf[temp_len] = '\0';
+ } else
g_strlcpy(buf, BUF_TOO_SMALL_ERR, buf_len);/* Let the unexpected value alert user */
}
}