aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--epan/emem.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/epan/emem.c b/epan/emem.c
index 77e9e97743..ab77569d87 100644
--- a/epan/emem.c
+++ b/epan/emem.c
@@ -839,8 +839,12 @@ gchar *
ep_strndup(const gchar* src, size_t len)
{
gchar* dst = ep_alloc(len+1);
+ guint i;
+
+ for (i = 0; (i < len) && src[i]; i++)
+ dst[i] = src[i];
- g_strlcpy(dst, src, len+1);
+ dst[i] = '\0';
return dst;
}
@@ -988,8 +992,12 @@ gchar *
se_strndup(const gchar* src, size_t len)
{
gchar* dst = se_alloc(len+1);
+ guint i;
+
+ for (i = 0; (i < len) && src[i]; i++)
+ dst[i] = src[i];
- g_strlcpy(dst, src, len+1);
+ dst[i] = '\0';
return dst;
}