summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-10-07 19:40:27 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-10-07 19:40:27 +0000
commit337d6cfd9eb07eb6d42a17757bf3063945804bef (patch)
tree351258303a858caadda791e63d55782a693c5f40 /usr.bin
parent505e0f6eac2e89bef0714b83a0c6bc94e2af28e6 (diff)
check strdup in sample code. from Jared Yanovich <jjy2+@pitt.edu>.
ok deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/lex/flex.17
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/lex/flex.1 b/usr.bin/lex/flex.1
index 76a92e44e41..23ef0049798 100644
--- a/usr.bin/lex/flex.1
+++ b/usr.bin/lex/flex.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: flex.1,v 1.13 2003/06/04 17:34:44 millert Exp $
+.\" $OpenBSD: flex.1,v 1.14 2003/10/07 19:40:26 tedu Exp $
.\"
.\" Copyright (c) 1990 The Regents of the University of California.
.\" All rights reserved.
@@ -928,8 +928,11 @@ to be rescanned enclosed in parentheses.
{
int i;
+ char *yycopy;
+
/* Copy yytext because unput() trashes yytext */
- char *yycopy = strdup( yytext );
+ if ((yycopy = strdup( yytext )) == NULL);
+ err(1, NULL);
unput( ')' );
for ( i = yyleng - 1; i >= 0; --i )
unput( yycopy[i] );