summaryrefslogtreecommitdiffstats
path: root/xmalloc.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-10-03 13:07:42 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-10-03 13:07:42 +0000
commita5a17b40ee9cd25eae3c3d177abf4e4faa2dc4d8 (patch)
treee8d5ecdeda3d963441dada75f5042b5cc40cf3a3 /xmalloc.c
parentab6170d6bfafba722a6ce84221dd8b1854f0c742 (diff)
Skip exec on cmds. Also use xmemstrdup where appropriate.
Diffstat (limited to 'xmalloc.c')
-rw-r--r--xmalloc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmalloc.c b/xmalloc.c
index dff43189..b7ec6698 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -1,4 +1,4 @@
-/* $Id: xmalloc.c,v 1.3 2007-09-29 14:25:49 nicm Exp $ */
+/* $Id: xmalloc.c,v 1.4 2007-10-03 13:07:42 nicm Exp $ */
/*
* Copyright (c) 2004 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -75,7 +75,8 @@ xmemstrdup(const char *buf, size_t len)
char *s;
s = xmalloc(len + 1);
- memcpy(s, buf, len);
+ if (len > 0)
+ memcpy(s, buf, len);
s[len] = '\0';
return (s);