Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/string pull in openbsd strlcat.c 1.3 -> 1.4.



details:   https://anonhg.NetBSD.org/src/rev/c1df9301f492
branches:  trunk
changeset: 502178:c1df9301f492
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sat Jan 13 04:19:54 2001 +0000

description:
pull in openbsd strlcat.c 1.3 -> 1.4.
Reverse the order of two loop invariant to make 'strlcat(0, "foo", 0)'
not get a SEGV; Richard Kettlewell <rjk%greenend.org.uk@localhost>

diffstat:

 lib/libc/string/strlcat.c |  8 ++++----
 lib/libc/string/strlcpy.c |  6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (49 lines):

diff -r b7aa0e18a56f -r c1df9301f492 lib/libc/string/strlcat.c
--- a/lib/libc/string/strlcat.c Sat Jan 13 03:48:26 2001 +0000
+++ b/lib/libc/string/strlcat.c Sat Jan 13 04:19:54 2001 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: strlcat.c,v 1.7 2001/01/03 14:33:02 lukem Exp $        */
-/*     from OpenBSD: strlcat.c,v 1.3 2000/11/24 11:10:02 itojun Exp    */
+/*     $NetBSD: strlcat.c,v 1.8 2001/01/13 04:19:54 itojun Exp $       */
+/*     $OpenBSD: strlcat.c,v 1.4 2001/01/12 22:55:23 millert Exp $     */
 
 /*
  * Copyright (c) 1998 Todd C. Miller <Todd.Miller%courtesan.com@localhost>
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strlcat.c,v 1.7 2001/01/03 14:33:02 lukem Exp $");
+__RCSID("$NetBSD: strlcat.c,v 1.8 2001/01/13 04:19:54 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -59,7 +59,7 @@
        _DIAGASSERT(src != NULL);
 
        /* Find the end of dst and adjust bytes left but don't go past end */
-       while (*d != '\0' && n-- != 0)
+       while (n-- != 0 && *d != '\0')
                d++;
        dlen = d - dst;
        n = siz - dlen;
diff -r b7aa0e18a56f -r c1df9301f492 lib/libc/string/strlcpy.c
--- a/lib/libc/string/strlcpy.c Sat Jan 13 03:48:26 2001 +0000
+++ b/lib/libc/string/strlcpy.c Sat Jan 13 04:19:54 2001 +0000
@@ -1,5 +1,5 @@
-/*     $NetBSD: strlcpy.c,v 1.6 2001/01/03 14:33:02 lukem Exp $        */
-/*     from OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp   */
+/*     $NetBSD: strlcpy.c,v 1.7 2001/01/13 04:19:54 itojun Exp $       */
+/*     $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $     */
 
 /*
  * Copyright (c) 1998 Todd C. Miller <Todd.Miller%courtesan.com@localhost>
@@ -30,7 +30,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: strlcpy.c,v 1.6 2001/01/03 14:33:02 lukem Exp $");
+__RCSID("$NetBSD: strlcpy.c,v 1.7 2001/01/13 04:19:54 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>



Home | Main Index | Thread Index | Old Index