From d71b1088f7f606de416019df86d888c4e53e1c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig=20Bj=C3=B8rlykke?= Date: Tue, 8 Dec 2009 10:17:37 +0000 Subject: [PATCH] From Jakub Zawadzki: Fix win64 build. svn path=/trunk/; revision=31204 --- epan/to_str.c | 12 ++++++------ 1 file 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 */ } }