[Forensics-changes] [yara] 156/415: Show an error message for non-ascii characters in rules
Hilko Bengen
bengen at moszumanska.debian.org
Thu Apr 3 05:42:58 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch debian
in repository yara.
commit 6e86a55fe955791e6cd3a7da12405962103d0b02
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Wed Apr 17 08:05:54 2013 +0000
Show an error message for non-ascii characters in rules
---
libyara/lex.c | 16 ++++++++++++----
libyara/lex.l | 10 +++++++++-
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/libyara/lex.c b/libyara/lex.c
index 80af46a..997fa0a 100644
--- a/libyara/lex.c
+++ b/libyara/lex.c
@@ -1671,15 +1671,23 @@ case 77:
YY_RULE_SETUP
#line 447 "lex.l"
{
- return yytext[0];
+ if (yytext[0] >= 32 && yytext[0] < 127)
+ {
+ return yytext[0];
+ }
+ else
+ {
+ yyerror(yyscanner, "non-ascii character");
+ yyterminate();
+ }
}
YY_BREAK
case 78:
YY_RULE_SETUP
-#line 450 "lex.l"
+#line 458 "lex.l"
ECHO;
YY_BREAK
-#line 1683 "lex.c"
+#line 1691 "lex.c"
case YY_END_OF_BUFFER:
{
@@ -2854,7 +2862,7 @@ void yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 450 "lex.l"
+#line 458 "lex.l"
diff --git a/libyara/lex.l b/libyara/lex.l
index 3f710af..4b40994 100644
--- a/libyara/lex.l
+++ b/libyara/lex.l
@@ -445,7 +445,15 @@ $({letter}|{digit}|_)* {
[ \t\r\n] /* skip whitespace */
. {
- return yytext[0];
+ if (yytext[0] >= 32 && yytext[0] < 127)
+ {
+ return yytext[0];
+ }
+ else
+ {
+ yyerror(yyscanner, "non-ascii character");
+ yyterminate();
+ }
}
%%
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git
More information about the forensics-changes
mailing list