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/lib Fix off-by-one error. (This was det...
details: https://anonhg.NetBSD.org/src/rev/6856c1bac5ac
branches: trunk
changeset: 471748:6856c1bac5ac
user: hubertf <hubertf%NetBSD.org@localhost>
date: Sat Apr 10 02:17:21 1999 +0000
description:
Fix off-by-one error. (This was detected using libefence)
diffstat:
usr.sbin/pkg_install/lib/str.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diffs (36 lines):
diff -r 24425c28b24d -r 6856c1bac5ac usr.sbin/pkg_install/lib/str.c
--- a/usr.sbin/pkg_install/lib/str.c Sat Apr 10 02:15:46 1999 +0000
+++ b/usr.sbin/pkg_install/lib/str.c Sat Apr 10 02:17:21 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.15 1999/04/10 02:17:21 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.15 1999/04/10 02:17:21 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