From cd53acdc86c34f48d8c0ea0ec039a06ddaf730a3 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 26 Oct 2009 21:10:25 +0000 Subject: Use strlcpy instead of strncpy, pointed out by deraadt. --- usr.bin/tmux/xmalloc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'usr.bin/tmux') 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 @@ -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 * -- cgit v1.2.3