summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-12-30 02:06:01 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-12-30 02:06:01 +0000
commite06dbe7f545e86df350dcc049141d1a17fd6fa55 (patch)
treef5e500111543247ef33feecd4e065cee9c5c437b /usr.bin
parent720a1edfecf547ce947b63891d3416e588c3f37f (diff)
Restore error checking in tostring().
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/awk/tran.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/awk/tran.c b/usr.bin/awk/tran.c
index 691b411f6b8..ae6a508221f 100644
--- a/usr.bin/awk/tran.c
+++ b/usr.bin/awk/tran.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tran.c,v 1.11 2004/12/30 01:52:48 millert Exp $ */
+/* $OpenBSD: tran.c,v 1.12 2004/12/30 02:06:00 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -399,7 +399,12 @@ char *getpssval(Cell *vp) /* get string val of a Cell for print */
char *tostring(const char *s) /* make a copy of string s */
{
- return (strdup(s));
+ char *p;
+
+ p = strdup(s);
+ if (p == NULL)
+ FATAL("out of space in tostring on %s", s);
+ return p;
}
char *qstring(const char *is, int delim) /* collect string up to next delim */