summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/strlcat.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2001-01-12 22:55:23 +0000
committermillert <millert@openbsd.org>2001-01-12 22:55:23 +0000
commite85898525ad35df4b529b7faad8d6b6c813054ad (patch)
tree8df5e6c8ba521eb432a83478f66ce5add8b1a9fd /lib/libc/string/strlcat.c
parentadd SIOCSIFMTU; angelos@ coached (diff)
downloadwireguard-openbsd-e85898525ad35df4b529b7faad8d6b6c813054ad.tar.xz
wireguard-openbsd-e85898525ad35df4b529b7faad8d6b6c813054ad.zip
Reverse the order of two loop invariant to make 'strlcat(0, "foo", 0)'
not get a SEGV; Richard Kettlewell <rjk@greenend.org.uk>
Diffstat (limited to 'lib/libc/string/strlcat.c')
-rw-r--r--lib/libc/string/strlcat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/string/strlcat.c b/lib/libc/string/strlcat.c
index f7d43bb24b6..5a23ef285c3 100644
--- a/lib/libc/string/strlcat.c
+++ b/lib/libc/string/strlcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strlcat.c,v 1.3 2000/11/24 11:10:02 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>
@@ -28,7 +28,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcat.c,v 1.3 2000/11/24 11:10:02 itojun Exp $";
+static char *rcsid = "$OpenBSD: strlcat.c,v 1.4 2001/01/12 22:55:23 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -52,7 +52,7 @@ size_t strlcat(dst, src, siz)
size_t dlen;
/* 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;