diff options
author | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2022-03-13 23:27:55 +0000 |
---|---|---|
committer | Scott Soule Cheloha <cheloha@cvs.openbsd.org> | 2022-03-13 23:27:55 +0000 |
commit | b4fa9107475f0009e2e6e939c6ee806aacfb272c (patch) | |
tree | 10af17f07c47ab18667e432f6e1b0f8e10ef8db9 /usr.bin | |
parent | d33b567876c4a6147a1685c7b40f79058f73de9f (diff) |
ssh: xstrdup(): use memcpy(3)
Copying the given string into the buffer with strlcpy(3) confers no
benefit in this context because we have already determined the
string's length with strlen(3) in order to allocate that buffer.
Thread: https://marc.info/?l=openbsd-tech&m=164687525802691&w=2
ok dtucker@ millert@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/xmalloc.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.bin/ssh/xmalloc.c b/usr.bin/ssh/xmalloc.c index f22779903a1..b82b340241e 100644 --- a/usr.bin/ssh/xmalloc.c +++ b/usr.bin/ssh/xmalloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xmalloc.c,v 1.36 2019/11/12 22:32:48 djm Exp $ */ +/* $OpenBSD: xmalloc.c,v 1.37 2022/03/13 23:27:54 cheloha Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -85,8 +85,7 @@ xstrdup(const char *str) len = strlen(str) + 1; cp = xmalloc(len); - strlcpy(cp, str, len); - return cp; + return memcpy(cp, str, len); } int |