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@
-/* $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
len = strlen(str) + 1;
cp = xmalloc(len);
- strlcpy(cp, str, len);
- return cp;
+ return memcpy(cp, str, len);
}
int