diff options
Diffstat (limited to 'usr.bin/tmux/xmalloc.c')
-rw-r--r-- | usr.bin/tmux/xmalloc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/tmux/xmalloc.c b/usr.bin/tmux/xmalloc.c index 6756a14d435..13eac93dd6b 100644 --- a/usr.bin/tmux/xmalloc.c +++ b/usr.bin/tmux/xmalloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xmalloc.c,v 1.1 2009/06/01 22:58:49 nicm Exp $ */ +/* $OpenBSD: xmalloc.c,v 1.2 2009/10/26 21:10:24 nicm Exp $ */ /* * Copyright (c) 2004 Nicholas Marriott <nicm@users.sourceforge.net> @@ -29,13 +29,14 @@ char * xstrdup(const char *s) { - void *ptr; + char *ptr; size_t len; len = strlen(s) + 1; ptr = xmalloc(len); - return (strncpy(ptr, s, len)); + strlcpy(ptr, s, len); + return (ptr); } void * |