diff --git a/libyara/lexer.c b/libyara/lexer.c index f232f94768..baf4312e02 100644 --- a/libyara/lexer.c +++ b/libyara/lexer.c @@ -3549,6 +3549,9 @@ int yr_lex_parse_rules_bytes( compiler->errors = 0; + if (rules_data == NULL) + return 0; + if (yylex_init(&yyscanner) != 0) { compiler->errors = 1; @@ -3581,6 +3584,9 @@ int yr_lex_parse_rules_string( compiler->errors = 0; + if (rules_string == NULL) + return 0; + if (yylex_init(&yyscanner) != 0) { compiler->errors = 1; diff --git a/libyara/lexer.l b/libyara/lexer.l index ec6d4c655f..6501436e58 100644 --- a/libyara/lexer.l +++ b/libyara/lexer.l @@ -895,6 +895,9 @@ int yr_lex_parse_rules_bytes( compiler->errors = 0; + if (rules_data == NULL) + return 0; + if (yylex_init(&yyscanner) != 0) { compiler->errors = 1; @@ -927,6 +930,9 @@ int yr_lex_parse_rules_string( compiler->errors = 0; + if (rules_string == NULL) + return 0; + if (yylex_init(&yyscanner) != 0) { compiler->errors = 1;