mirror of
https://github.com/tmux/tmux.git
synced 2025-03-13 21:58:48 +00:00
Sync OpenBSD patchset 463:
Use strlcpy instead of strncpy, pointed out by deraadt.
This commit is contained in:
parent
876ded6dfe
commit
88bb9381b2
@ -1,4 +1,4 @@
|
|||||||
/* $Id: xmalloc.c,v 1.10 2009-06-25 16:47:00 nicm Exp $ */
|
/* $Id: xmalloc.c,v 1.11 2009-10-28 23:08:04 tcunha Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2004 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2004 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -29,13 +29,14 @@
|
|||||||
char *
|
char *
|
||||||
xstrdup(const char *s)
|
xstrdup(const char *s)
|
||||||
{
|
{
|
||||||
void *ptr;
|
char *ptr;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
len = strlen(s) + 1;
|
len = strlen(s) + 1;
|
||||||
ptr = xmalloc(len);
|
ptr = xmalloc(len);
|
||||||
|
|
||||||
return (strncpy(ptr, s, len));
|
strlcpy(ptr, s, len);
|
||||||
|
return (ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
|
Loading…
Reference in New Issue
Block a user