summaryrefslogtreecommitdiff
path: root/usr.bin/sort/sort.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2007-03-07 18:11:04 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2007-03-07 18:11:04 +0000
commita79c2c43999d2c5c5ca6f84d3f0a4f036d0e21b4 (patch)
tree983cc9fb59f184b8790f8b1ce709aaf1b2f5fc2a /usr.bin/sort/sort.c
parent577a9f29e7e7f9565e573a6e48ac3061cd90b62f (diff)
Use separate buffers in fsort.c and msort.c. Fixes a problem with
buffer corruptions for some very large files. Also fixes some TRECHEADER vs. RECHEADER mismatches. OK deraadt@ otto@ ray@
Diffstat (limited to 'usr.bin/sort/sort.c')
-rw-r--r--usr.bin/sort/sort.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c
index 90ba230554a..cbe5e5f8579 100644
--- a/usr.bin/sort/sort.c
+++ b/usr.bin/sort/sort.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sort.c,v 1.31 2006/10/29 18:40:34 millert Exp $ */
+/* $OpenBSD: sort.c,v 1.32 2007/03/07 18:11:03 millert Exp $ */
/*-
* Copyright (c) 1993
@@ -42,7 +42,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)sort.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: sort.c,v 1.31 2006/10/29 18:40:34 millert Exp $";
+static char rcsid[] = "$OpenBSD: sort.c,v 1.32 2007/03/07 18:11:03 millert Exp $";
#endif
#endif /* not lint */
@@ -254,10 +254,7 @@ main(int argc, char *argv[])
else
get = makekey;
- if ((buffer = malloc(bufsize)) == NULL)
- err(2, NULL);
- bufend = buffer + bufsize - 1;
- if (!SINGL_FLD) {
+ if (!SINGL_FLD) {
if ((linebuf = malloc(linebuf_size)) == NULL)
err(2, NULL);
}