summaryrefslogtreecommitdiff
path: root/xmalloc.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-08-06 21:03:23 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-08-06 21:03:23 +0000
commitff6458e03e64e0942379bed22119e902e4cc2b08 (patch)
tree538cf7c5c8ecdbfc8724ff7c85e9792caee3bc21 /xmalloc.c
parent940fb86c9a0ff501f812041ebaad09538c09b1b8 (diff)
- stevesk@cvs.openbsd.org 2001/07/23 18:21:46
[xmalloc.c] no zero size xstrdup() error; ok markus@
Diffstat (limited to 'xmalloc.c')
-rw-r--r--xmalloc.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/xmalloc.c b/xmalloc.c
index 504662749..99c6ac330 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: xmalloc.c,v 1.15 2001/04/16 08:05:34 deraadt Exp $"); 16RCSID("$OpenBSD: xmalloc.c,v 1.16 2001/07/23 18:21:46 stevesk Exp $");
17 17
18#include "xmalloc.h" 18#include "xmalloc.h"
19#include "log.h" 19#include "log.h"
@@ -58,11 +58,10 @@ xfree(void *ptr)
58char * 58char *
59xstrdup(const char *str) 59xstrdup(const char *str)
60{ 60{
61 size_t len = strlen(str) + 1; 61 size_t len;
62 char *cp; 62 char *cp;
63 63
64 if (len == 0) 64 len = strlen(str) + 1;
65 fatal("xstrdup: zero size");
66 cp = xmalloc(len); 65 cp = xmalloc(len);
67 strlcpy(cp, str, len); 66 strlcpy(cp, str, len);
68 return cp; 67 return cp;