summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/xmalloc.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-10-26 21:10:24 +0000
committernicm <nicm@openbsd.org>2009-10-26 21:10:24 +0000
commit336ebe05dd1719fe3eb314638bda64c35264fe9a (patch)
treeeb8bef0f8fc60800b49734d54fc5aeb124497fb6 /usr.bin/tmux/xmalloc.c
parentadd ENOTSUP and bump libc minor (diff)
downloadwireguard-openbsd-336ebe05dd1719fe3eb314638bda64c35264fe9a.tar.xz
wireguard-openbsd-336ebe05dd1719fe3eb314638bda64c35264fe9a.zip
Use strlcpy instead of strncpy, pointed out by deraadt.
Diffstat (limited to 'usr.bin/tmux/xmalloc.c')
-rw-r--r--usr.bin/tmux/xmalloc.c7
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 *