Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/pkg_install Ensure readlink(2) result termination w...



details:   https://anonhg.NetBSD.org/src/rev/1e609ebcba47
branches:  trunk
changeset: 566485:1e609ebcba47
user:      kleink <kleink%NetBSD.org@localhost>
date:      Mon May 10 19:59:59 2004 +0000

description:
Ensure readlink(2) result termination within buffer bounds.

diffstat:

 usr.sbin/pkg_install/admin/main.c |  6 +++---
 usr.sbin/pkg_install/create/pl.c  |  6 +++---
 usr.sbin/pkg_install/lib/plist.c  |  6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diffs (75 lines):

diff -r 921aee817197 -r 1e609ebcba47 usr.sbin/pkg_install/admin/main.c
--- a/usr.sbin/pkg_install/admin/main.c Mon May 10 19:23:48 2004 +0000
+++ b/usr.sbin/pkg_install/admin/main.c Mon May 10 19:59:59 2004 +0000
@@ -1,8 +1,8 @@
-/*     $NetBSD: main.c,v 1.43 2004/01/15 09:33:38 agc Exp $    */
+/*     $NetBSD: main.c,v 1.44 2004/05/10 19:59:59 kleink Exp $ */
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.43 2004/01/15 09:33:38 agc Exp $");
+__RCSID("$NetBSD: main.c,v 1.44 2004/05/10 19:59:59 kleink Exp $");
 #endif
 
 /*
@@ -132,7 +132,7 @@
 
                                                (void) strlcpy(buf, SYMLINK_HEADER, sizeof(buf));
                                                if ((cc = readlink(file, &buf[SymlinkHeaderLen],
-                                                         sizeof(buf) - SymlinkHeaderLen)) < 0) {
+                                                         sizeof(buf) - SymlinkHeaderLen - 1)) < 0) {
                                                        warnx("can't readlink `%s'", file);
                                                } else {
                                                        buf[SymlinkHeaderLen + cc] = 0x0;
diff -r 921aee817197 -r 1e609ebcba47 usr.sbin/pkg_install/create/pl.c
--- a/usr.sbin/pkg_install/create/pl.c  Mon May 10 19:23:48 2004 +0000
+++ b/usr.sbin/pkg_install/create/pl.c  Mon May 10 19:59:59 2004 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: pl.c,v 1.30 2004/01/15 09:33:39 agc Exp $      */
+/*     $NetBSD: pl.c,v 1.31 2004/05/10 19:59:59 kleink Exp $   */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: pl.c,v 1.11 1997/10/08 07:46:35 charnier Exp";
 #else
-__RCSID("$NetBSD: pl.c,v 1.30 2004/01/15 09:33:39 agc Exp $");
+__RCSID("$NetBSD: pl.c,v 1.31 2004/05/10 19:59:59 kleink Exp $");
 #endif
 #endif
 
@@ -198,7 +198,7 @@
                                (void) strlcpy(target, SYMLINK_HEADER,
                                    sizeof(target));
                                if ((cc = readlink(name, &target[SymlinkHeaderLen],
-                                         sizeof(target) - SymlinkHeaderLen)) < 0) {
+                                         sizeof(target) - SymlinkHeaderLen - 1)) < 0) {
                                        warnx("can't readlink `%s'", name);
                                        continue;
                                }
diff -r 921aee817197 -r 1e609ebcba47 usr.sbin/pkg_install/lib/plist.c
--- a/usr.sbin/pkg_install/lib/plist.c  Mon May 10 19:23:48 2004 +0000
+++ b/usr.sbin/pkg_install/lib/plist.c  Mon May 10 19:59:59 2004 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: plist.c,v 1.42 2004/01/15 09:33:39 agc Exp $   */
+/*     $NetBSD: plist.c,v 1.43 2004/05/10 19:59:59 kleink Exp $        */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: plist.c,v 1.24 1997/10/08 07:48:15 charnier Exp";
 #else
-__RCSID("$NetBSD: plist.c,v 1.42 2004/01/15 09:33:39 agc Exp $");
+__RCSID("$NetBSD: plist.c,v 1.43 2004/05/10 19:59:59 kleink Exp $");
 #endif
 #endif
 
@@ -391,7 +391,7 @@
                                                (void) strlcpy(buf, SYMLINK_HEADER,
                                                    sizeof(buf));
                                                if ((cc = readlink(tmp, &buf[SymlinkHeaderLen],
-                                                         sizeof(buf) - SymlinkHeaderLen)) < 0) {
+                                                         sizeof(buf) - SymlinkHeaderLen - 1)) < 0) {
                                                        warnx("can't readlink `%s'", tmp);
                                                        continue;
                                                }



Home | Main Index | Thread Index | Old Index