diff options
author | 2009-10-26 21:10:24 +0000 | |
---|---|---|
committer | 2009-10-26 21:10:24 +0000 | |
commit | 336ebe05dd1719fe3eb314638bda64c35264fe9a (patch) | |
tree | eb8bef0f8fc60800b49734d54fc5aeb124497fb6 /usr.bin/tmux/xmalloc.c | |
parent | add ENOTSUP and bump libc minor (diff) | |
download | wireguard-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.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 * |