summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-09-23 11:54:01 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-09-23 11:54:01 +0000
commitcaecf6e09c136c8e023c64c55b48dd0e0b42f26d (patch)
tree4d4bd9dbb070f011faa9718675d5c5c16512aedb /usr.bin
parent105a204fd2ed1b7514e2bf44df67cdd55e998b30 (diff)
avoid crash when dealing with ^M lines; roberte@MEP.Ruhr-Uni-Bochum.de
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/fmt/fmt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c
index 65d59cc318e..c192e7e47b9 100644
--- a/usr.bin/fmt/fmt.c
+++ b/usr.bin/fmt/fmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fmt.c,v 1.6 1997/02/08 10:23:39 deraadt Exp $ */
+/* $OpenBSD: fmt.c,v 1.7 1997/09/23 11:54:00 deraadt Exp $ */
/* $NetBSD: fmt.c,v 1.4 1995/09/01 01:29:41 jtc Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)fmt.c 8.1 (Berkeley) 7/20/93";
#else
-static char rcsid[] = "$OpenBSD: fmt.c,v 1.6 1997/02/08 10:23:39 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: fmt.c,v 1.7 1997/09/23 11:54:00 deraadt Exp $";
#endif
#endif /* not lint */
@@ -176,6 +176,10 @@ fmt(fi)
register int c, col;
#define CHUNKSIZE 1024
+ canonb = malloc(CHUNKSIZE);
+ if (canonb == 0)
+ errx(1, "Ran out of memory");
+
if (center) {
register int len;