summaryrefslogtreecommitdiff
path: root/usr.bin/sort
diff options
context:
space:
mode:
authorJared Yanovich <jaredy@cvs.openbsd.org>2005-08-18 14:56:26 +0000
committerJared Yanovich <jaredy@cvs.openbsd.org>2005-08-18 14:56:26 +0000
commitd58349f75433143b1652c58a12991a7ca69fec84 (patch)
tree25219c3fe0f66fe14aa90c2c4dd8e09128d33583 /usr.bin/sort
parentf99461a9cd3ddae1566dfbdb7fc691950ef45016 (diff)
Properly initialize 'end' in seq(), fixing a crash
on input with long lines when the -n flag is given. ok millert
Diffstat (limited to 'usr.bin/sort')
-rw-r--r--usr.bin/sort/files.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/sort/files.c b/usr.bin/sort/files.c
index d8592a37b10..fb8973518b6 100644
--- a/usr.bin/sort/files.c
+++ b/usr.bin/sort/files.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: files.c,v 1.11 2004/07/20 03:50:27 deraadt Exp $ */
+/* $OpenBSD: files.c,v 1.12 2005/08/18 14:56:25 jaredy Exp $ */
/*-
* Copyright (c) 1993
@@ -36,7 +36,7 @@
#if 0
static char sccsid[] = "@(#)files.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: files.c,v 1.11 2004/07/20 03:50:27 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: files.c,v 1.12 2005/08/18 14:56:25 jaredy Exp $";
#endif
#endif /* not lint */
@@ -267,10 +267,10 @@ seq(FILE *fp, DBT *line, DBT *key)
if (flag) {
flag = 0;
buf = (char *) linebuf;
- end = buf + linebuf_size;
line->data = buf;
}
pos = buf;
+ end = buf + linebuf_size;
while ((c = getc(fp)) != EOF) {
if ((*pos++ = c) == REC_D) {
line->size = pos - buf;