summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@NetBSD.org>1999-08-10 20:09:02 +0000
committertron <tron@NetBSD.org>1999-08-10 20:09:02 +0000
commitc8b0d0494959983c1944e5bff2fe4d116d7ce246 (patch)
tree8f6c59a70cda13959b9efcff2d62e73f754638c5
parentb701be7c869038ae880e038252a3c75d78f5986b (diff)
Fix wrong array size calculation in call to memset() and avoid a possible
segmentation fault in memmove(). Patches supplied by Stephan Thesing in PR bin/8184.
-rw-r--r--usr.bin/join/join.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/join/join.c b/usr.bin/join/join.c
index 264312eb3b9..95026275996 100644
--- a/usr.bin/join/join.c
+++ b/usr.bin/join/join.c
@@ -1,4 +1,4 @@
-/* $NetBSD: join.c,v 1.15 1998/12/19 17:05:30 christos Exp $ */
+/* $NetBSD: join.c,v 1.16 1999/08/10 20:09:02 tron Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -48,7 +48,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "from: @(#)join.c 5.1 (Berkeley) 11/18/91";
#else
-__RCSID("$NetBSD: join.c,v 1.15 1998/12/19 17:05:30 christos Exp $");
+__RCSID("$NetBSD: join.c,v 1.16 1999/08/10 20:09:02 tron Exp $");
#endif
#endif /* not lint */
@@ -317,7 +317,7 @@ slurp(F)
if ((F->set = realloc(F->set,
F->setalloc * sizeof(LINE))) == NULL)
enomem();
- memset(F->set + cnt, 0, 100 * sizeof(LINE *));
+ memset(F->set + cnt, 0, 100 * sizeof(LINE));
}
/*
@@ -347,7 +347,7 @@ slurp(F)
lp->linealloc * sizeof(char))) == NULL)
enomem();
}
- memmove(lp->line, bp, len+1);
+ memmove(lp->line, bp, len);
/* Replace trailing newline, if it exists. */
if (bp[len - 1] == '\n')