Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/usr.sbin/pkg_install/lib Pullup 1.14->1.15
details: https://anonhg.NetBSD.org/src/rev/e7efb8174b50
branches: netbsd-1-4
changeset: 468172:e7efb8174b50
user: hubertf <hubertf%NetBSD.org@localhost>
date: Mon Apr 12 02:55:47 1999 +0000
description:
Pullup 1.14->1.15
This fixes a off-by-one error which can cause coredumps (at least) in
pkg_add.
diffstat:
usr.sbin/pkg_install/lib/str.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diffs (36 lines):
diff -r 9c83b6989308 -r e7efb8174b50 usr.sbin/pkg_install/lib/str.c
--- a/usr.sbin/pkg_install/lib/str.c Mon Apr 12 01:30:23 1999 +0000
+++ b/usr.sbin/pkg_install/lib/str.c Mon Apr 12 02:55:47 1999 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: str.c,v 1.14 1999/03/22 05:02:41 hubertf Exp $ */
+/* $NetBSD: str.c,v 1.14.2.1 1999/04/12 02:55:47 hubertf Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp";
#else
-__RCSID("$NetBSD: str.c,v 1.14 1999/03/22 05:02:41 hubertf Exp $");
+__RCSID("$NetBSD: str.c,v 1.14.2.1 1999/04/12 02:55:47 hubertf Exp $");
#endif
#endif
@@ -50,15 +50,15 @@
char *s;
char *t;
- if ((s = strrchr(path, '/')) == (char *) NULL) {
+ if ((s = strrchr(path, '/')) == NULL) {
return ".";
}
if (s == path) {
/* "/foo" -> return "/" */
return "/";
}
- cc = (size_t)(s - path) + 1;
- if ((t = (char *) malloc(cc)) == (char *) NULL) {
+ cc = (size_t)(s - path);
+ if ((t = (char *) malloc(cc+1)) == (char *) NULL) {
errx(1, "out of memory in dirname_of");
}
(void) memcpy(t, path, cc);
Home |
Main Index |
Thread Index |
Old Index