Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/ypserv/makedbm fix up lossage WRT free()ing invalid...
details: https://anonhg.NetBSD.org/src/rev/b90206a69bdd
branches: trunk
changeset: 474893:b90206a69bdd
user: lukem <lukem%NetBSD.org@localhost>
date: Sun Jul 25 07:59:48 1999 +0000
description:
fix up lossage WRT free()ing invalid pointers.
noted in [bin/8064]
diffstat:
usr.sbin/ypserv/makedbm/makedbm.c | 32 ++++++++++++++------------------
1 files changed, 14 insertions(+), 18 deletions(-)
diffs (57 lines):
diff -r a969aee4eafc -r b90206a69bdd usr.sbin/ypserv/makedbm/makedbm.c
--- a/usr.sbin/ypserv/makedbm/makedbm.c Sun Jul 25 07:06:05 1999 +0000
+++ b/usr.sbin/ypserv/makedbm/makedbm.c Sun Jul 25 07:59:48 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: makedbm.c,v 1.15 1999/06/07 03:06:08 mrg Exp $ */
+/* $NetBSD: makedbm.c,v 1.16 1999/07/25 07:59:48 lukem Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj%stacken.kth.se@localhost>
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: makedbm.c,v 1.15 1999/06/07 03:06:08 mrg Exp $");
+__RCSID("$NetBSD: makedbm.c,v 1.16 1999/07/25 07:59:48 lukem Exp $");
#endif
#include <sys/param.h>
@@ -296,26 +296,22 @@
for (;
(p = fparseln(data_file, &len, &line_no, NULL, FPARSELN_UNESCALL));
free(p)) {
- while (*p && isspace(*p)) /* skip leading whitespace */
- p++;
+ k = p; /* set start of key */
+ while (*k && isspace(*k)) /* skip leading whitespace */
+ k++;
- if (! *p)
+ if (! *k)
continue;
- k = p; /* save start of key */
- while (*p && !isspace(*p)) { /* find whitespace */
- /* Convert to lower case if forcing. */
- if (lflag && isupper(*p))
- *p = tolower(*p);
- p++;
+ v = k;
+ while (*v && !isspace(*v)) { /* find leading whitespace */
+ /* convert key to lower case if forcing. */
+ if (lflag && isupper(*v))
+ *v = tolower(*v);
+ v++;
}
- if (! *p)
- v = ""; /* no value found - use "" */
- else {
- while (isspace(*p)) /* replace space with <NUL> */
- *p++ = '\0';
- v = p; /* save start of value */
- }
+ while (*v && isspace(*v)) /* replace space with <NUL> */
+ *v++ = '\0';
if (add_record(new_db, k, v, TRUE)) { /* save record */
bad_record:
Home |
Main Index |
Thread Index |
Old Index