summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-10-26 21:10:25 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-10-26 21:10:25 +0000
commitcd53acdc86c34f48d8c0ea0ec039a06ddaf730a3 (patch)
tree575a08b456149fe9ce08a5c786fffe89c4d4ba9f /usr.bin/tmux
parentd074c51588652c577ec3acef265d5a49344144ce (diff)
Use strlcpy instead of strncpy, pointed out by deraadt.
Diffstat (limited to 'usr.bin/tmux')
-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 *