summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-06-28 14:48:28 +1000
committerDamien Miller <djm@mindrot.org>2001-06-28 14:48:28 +1000
commit180207ffe1a54bb15d10ce54fdc854b8dcd0511f (patch)
treecb5a7d07cd28ff08c26f163112d33b7ded283ff6
parent315f8b70b0e255fd7c2222794631d233569ce22b (diff)
20010628
- (djm) Sync openbsd-compat with -current libc
-rw-r--r--ChangeLog5
-rw-r--r--openbsd-compat/dirname.c7
-rw-r--r--openbsd-compat/realpath.c5
-rw-r--r--openbsd-compat/strlcat.c11
-rw-r--r--openbsd-compat/strlcpy.c7
5 files changed, 19 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index b667e02e7..c4a3475e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
120010628
2 - (djm) Sync openbsd-compat with -current libc
3
120010627 420010627
2 - (djm) Reintroduce pam_session call for non-pty sessions. 5 - (djm) Reintroduce pam_session call for non-pty sessions.
3 - (djm) Remove redundant and incorrect test for max auth attempts in 6 - (djm) Remove redundant and incorrect test for max auth attempts in
@@ -5809,4 +5812,4 @@
5809 - Wrote replacements for strlcpy and mkdtemp 5812 - Wrote replacements for strlcpy and mkdtemp
5810 - Released 1.0pre1 5813 - Released 1.0pre1
5811 5814
5812$Id: ChangeLog,v 1.1334 2001/06/28 00:24:41 stevesk Exp $ 5815$Id: ChangeLog,v 1.1335 2001/06/28 04:48:28 djm Exp $
diff --git a/openbsd-compat/dirname.c b/openbsd-compat/dirname.c
index c29082673..a76a1dc13 100644
--- a/openbsd-compat/dirname.c
+++ b/openbsd-compat/dirname.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dirname.c,v 1.4 1999/05/30 17:10:30 espie Exp $ */ 1/* $OpenBSD: dirname.c,v 1.5 2001/06/27 00:58:54 lebel Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
31#ifndef HAVE_DIRNAME 31#ifndef HAVE_DIRNAME
32 32
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34static char rcsid[] = "$OpenBSD: dirname.c,v 1.4 1999/05/30 17:10:30 espie Exp $"; 34static char rcsid[] = "$OpenBSD: dirname.c,v 1.5 2001/06/27 00:58:54 lebel Exp $";
35#endif /* LIBC_SCCS and not lint */ 35#endif /* LIBC_SCCS and not lint */
36 36
37#include <errno.h> 37#include <errno.h>
@@ -74,8 +74,7 @@ dirname(path)
74 errno = ENAMETOOLONG; 74 errno = ENAMETOOLONG;
75 return(NULL); 75 return(NULL);
76 } 76 }
77 (void)strncpy(bname, path, endp - path + 1); 77 strlcpy(bname, path, endp - path + 2);
78 bname[endp - path + 1] = '\0';
79 return(bname); 78 return(bname);
80} 79}
81#endif 80#endif
diff --git a/openbsd-compat/realpath.c b/openbsd-compat/realpath.c
index fbe2a9c2c..ec801d498 100644
--- a/openbsd-compat/realpath.c
+++ b/openbsd-compat/realpath.c
@@ -32,7 +32,7 @@
32#if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH) 32#if !defined(HAVE_REALPATH) || defined(BROKEN_REALPATH)
33 33
34#if defined(LIBC_SCCS) && !defined(lint) 34#if defined(LIBC_SCCS) && !defined(lint)
35static char *rcsid = "$OpenBSD: realpath..c,v 1.4 1998/05/18 09:55:19 deraadt Exp $"; 35static char *rcsid = "$OpenBSD: realpath.c,v 1.5 2001/06/27 00:58:56 lebel Exp $";
36#endif /* LIBC_SCCS and not lint */ 36#endif /* LIBC_SCCS and not lint */
37 37
38#include <sys/param.h> 38#include <sys/param.h>
@@ -82,8 +82,7 @@ realpath(const char *path, char *resolved)
82 * if it is a directory, then change to that directory. 82 * if it is a directory, then change to that directory.
83 * get the current directory name and append the basename. 83 * get the current directory name and append the basename.
84 */ 84 */
85 (void)strncpy(resolved, path, MAXPATHLEN - 1); 85 strlcpy(resolved, path, MAXPATHLEN);
86 resolved[MAXPATHLEN - 1] = '\0';
87loop: 86loop:
88 q = strrchr(resolved, '/'); 87 q = strrchr(resolved, '/');
89 if (q != NULL) { 88 if (q != NULL) {
diff --git a/openbsd-compat/strlcat.c b/openbsd-compat/strlcat.c
index d80739fc6..6ff65c19b 100644
--- a/openbsd-compat/strlcat.c
+++ b/openbsd-compat/strlcat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strlcat.c,v 1.5 2001/01/13 16:17:24 millert Exp $ */ 1/* $OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
31#ifndef HAVE_STRLCAT 31#ifndef HAVE_STRLCAT
32 32
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34static char *rcsid = "$OpenBSD: strlcat.c,v 1.5 2001/01/13 16:17:24 millert Exp $"; 34static char *rcsid = "$OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp $";
35#endif /* LIBC_SCCS and not lint */ 35#endif /* LIBC_SCCS and not lint */
36 36
37#include <sys/types.h> 37#include <sys/types.h>
@@ -42,10 +42,11 @@ static char *rcsid = "$OpenBSD: strlcat.c,v 1.5 2001/01/13 16:17:24 millert Exp
42 * Appends src to string dst of size siz (unlike strncat, siz is the 42 * Appends src to string dst of size siz (unlike strncat, siz is the
43 * full size of dst, not space left). At most siz-1 characters 43 * full size of dst, not space left). At most siz-1 characters
44 * will be copied. Always NUL terminates (unless siz <= strlen(dst)). 44 * will be copied. Always NUL terminates (unless siz <= strlen(dst)).
45 * Returns strlen(initial dst) + strlen(src); if retval >= siz, 45 * Returns strlen(src) + MIN(siz, strlen(initial dst)).
46 * truncation occurred. 46 * If retval >= siz, truncation occurred.
47 */ 47 */
48size_t strlcat(dst, src, siz) 48size_t
49strlcat(dst, src, siz)
49 char *dst; 50 char *dst;
50 const char *src; 51 const char *src;
51 size_t siz; 52 size_t siz;
diff --git a/openbsd-compat/strlcpy.c b/openbsd-compat/strlcpy.c
index 99b06dd90..b5e5a552e 100644
--- a/openbsd-compat/strlcpy.c
+++ b/openbsd-compat/strlcpy.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $ */ 1/* $OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
31#ifndef HAVE_STRLCPY 31#ifndef HAVE_STRLCPY
32 32
33#if defined(LIBC_SCCS) && !defined(lint) 33#if defined(LIBC_SCCS) && !defined(lint)
34static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $"; 34static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp $";
35#endif /* LIBC_SCCS and not lint */ 35#endif /* LIBC_SCCS and not lint */
36 36
37#include <sys/types.h> 37#include <sys/types.h>
@@ -43,7 +43,8 @@ static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp
43 * will be copied. Always NUL terminates (unless siz == 0). 43 * will be copied. Always NUL terminates (unless siz == 0).
44 * Returns strlen(src); if retval >= siz, truncation occurred. 44 * Returns strlen(src); if retval >= siz, truncation occurred.
45 */ 45 */
46size_t strlcpy(dst, src, siz) 46size_t
47strlcpy(dst, src, siz)
47 char *dst; 48 char *dst;
48 const char *src; 49 const char *src;
49 size_t siz; 50 size_t siz;