mirror of
https://github.com/clearml/dropbear
synced 2025-02-07 13:21:15 +00:00
upgrade strlcat
in order to remove K&R code
This commit is contained in:
parent
81a0240491
commit
37a66fa5b6
17
compat.c
17
compat.c
@ -114,8 +114,8 @@ size_t strlcpy(char *dst, const char *src, size_t size) {
|
|||||||
#endif /* HAVE_STRLCPY */
|
#endif /* HAVE_STRLCPY */
|
||||||
|
|
||||||
#ifndef HAVE_STRLCAT
|
#ifndef HAVE_STRLCAT
|
||||||
/* taken from openbsd-compat for OpenSSH 3.6.1p1 */
|
/* taken from openbsd-compat for OpenSSH 7.2p2 */
|
||||||
/* "$OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp $"
|
/* "$OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $"
|
||||||
*
|
*
|
||||||
* Appends src to string dst of size siz (unlike strncat, siz is the
|
* Appends src to string dst of size siz (unlike strncat, siz is the
|
||||||
* full size of dst, not space left). At most siz-1 characters
|
* full size of dst, not space left). At most siz-1 characters
|
||||||
@ -123,15 +123,12 @@ size_t strlcpy(char *dst, const char *src, size_t size) {
|
|||||||
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
|
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
|
||||||
* If retval >= siz, truncation occurred.
|
* If retval >= siz, truncation occurred.
|
||||||
*/
|
*/
|
||||||
size_t
|
size_t
|
||||||
strlcat(dst, src, siz)
|
strlcat(char *dst, const char *src, size_t siz)
|
||||||
char *dst;
|
|
||||||
const char *src;
|
|
||||||
size_t siz;
|
|
||||||
{
|
{
|
||||||
register char *d = dst;
|
char *d = dst;
|
||||||
register const char *s = src;
|
const char *s = src;
|
||||||
register size_t n = siz;
|
size_t n = siz;
|
||||||
size_t dlen;
|
size_t dlen;
|
||||||
|
|
||||||
/* Find the end of dst and adjust bytes left but don't go past end */
|
/* Find the end of dst and adjust bytes left but don't go past end */
|
||||||
|
Loading…
Reference in New Issue
Block a user