flex/flex-2.5.35-hardening.patch
Petr Machata db7d0160b5 - Resolves: #496548.
Mon Apr 20 2009 Petr Machata <pmachata@redhat.com> - 2.5.35-4
- Get rid of warning caused by ignoring return value of fwrite() in ECHO
    macro. Debian patch.
- Resolves: #484961
2009-04-20 11:26:12 +00:00

37 lines
1.3 KiB
Diff

diff -u flex-2.5.35/scan.c flex-2.5.35/scan.c
--- flex-2.5.35/scan.c
+++ flex-2.5.35/scan.c
@@ -2096,7 +2096,7 @@
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
diff -u flex-2.5.35/flex.skl flex-2.5.35/flex.skl
--- flex-2.5.35/flex.skl
+++ flex-2.5.35/flex.skl
@@ -1075,7 +1075,7 @@
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
%endif
%if-c++-only C++ definition
#define ECHO LexerOutput( yytext, yyleng )
diff -u flex-2.5.35/skel.c flex-2.5.35/skel.c
--- flex-2.5.35/skel.c
+++ flex-2.5.35/skel.c
@@ -1142,7 +1142,7 @@
"/* This used to be an fputs(), but since the string might contain NUL's,",
" * we now use fwrite().",
" */",
- "#define ECHO fwrite( yytext, yyleng, 1, yyout )",
+ "#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)",
"%endif",
"%if-c++-only C++ definition",
"#define ECHO LexerOutput( yytext, yyleng )",