Browse Source

strlcat() should return strlen(dst) + strlen(src) when size parameter

<= strlen(dst).  Bug report by mark.murnane@ireland.sun.com via the
GNOME folks.
OPENBSD_3_0
millert 23 years ago
parent
commit
8d74ec2cc3
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/lib/libc/string/strlcat.c

+ 3
- 3
src/lib/libc/string/strlcat.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: strlcat.c,v 1.5 2001/01/13 16:17:24 millert Exp $ */
/* $OpenBSD: strlcat.c,v 1.6 2001/05/07 15:18:30 millert Exp $ */
/* /*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@ -28,7 +28,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: strlcat.c,v 1.5 2001/01/13 16:17:24 millert Exp $";
static char *rcsid = "$OpenBSD: strlcat.c,v 1.6 2001/05/07 15:18:30 millert Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
@ -58,7 +58,7 @@ size_t strlcat(dst, src, siz)
n = siz - dlen; n = siz - dlen;
if (n == 0) if (n == 0)
return(dlen + strlen(s));
return(strlen(dst) + strlen(s));
while (*s != '\0') { while (*s != '\0') {
if (n != 1) { if (n != 1) {
*d++ = *s; *d++ = *s;


Loading…
Cancel
Save