[Forensics-changes] [yara] 98/415: Fixed memory leak in bitwise operations and buffer overflow (issue 22)
Hilko Bengen
bengen at moszumanska.debian.org
Thu Apr 3 05:42:50 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 76855241ce2e7b0366215151150f19f76792ed84
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Mon Jun 27 18:58:28 2011 +0000
Fixed memory leak in bitwise operations and buffer overflow (issue 22)
---
libyara/ast.c | 5 +++++
libyara/lex.c | 4 ++--
libyara/lex.l | 4 ++--
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/libyara/ast.c b/libyara/ast.c
index 145edcc..dd676c6 100644
--- a/libyara/ast.c
+++ b/libyara/ast.c
@@ -908,12 +908,17 @@ void free_term(TERM* term)
case TERM_TYPE_EQ:
case TERM_TYPE_OF:
case TERM_TYPE_NOT_EQ:
+ case TERM_TYPE_SHIFT_LEFT:
+ case TERM_TYPE_SHIFT_RIGHT:
+ case TERM_TYPE_BITWISE_OR:
+ case TERM_TYPE_BITWISE_AND:
free_term(((TERM_BINARY_OPERATION*)term)->op1);
free_term(((TERM_BINARY_OPERATION*)term)->op2);
break;
case TERM_TYPE_NOT:
+ case TERM_TYPE_BITWISE_NOT:
case TERM_TYPE_INT8_AT_OFFSET:
case TERM_TYPE_INT16_AT_OFFSET:
case TERM_TYPE_INT32_AT_OFFSET:
diff --git a/libyara/lex.c b/libyara/lex.c
index 3470a33..2d37a0a 100644
--- a/libyara/lex.c
+++ b/libyara/lex.c
@@ -2827,8 +2827,8 @@ void yyerror(yyscan_t yyscanner, const char *error_message)
if (error_message != NULL)
{
context->last_error = ERROR_SYNTAX_ERROR;
- strncpy(context->last_error_extra_info, error_message, sizeof(message) - 1);
- context->last_error_extra_info[sizeof(message)-1] = '\0';
+ strncpy(context->last_error_extra_info, error_message, sizeof(context->last_error_extra_info) - 1);
+ context->last_error_extra_info[sizeof(context->last_error_extra_info)-1] = '\0';
if (context->error_report_function != NULL)
{
diff --git a/libyara/lex.l b/libyara/lex.l
index e5f59ac..23b1aa4 100644
--- a/libyara/lex.l
+++ b/libyara/lex.l
@@ -426,8 +426,8 @@ void yyerror(yyscan_t yyscanner, const char *error_message)
if (error_message != NULL)
{
context->last_error = ERROR_SYNTAX_ERROR;
- strncpy(context->last_error_extra_info, error_message, sizeof(message) - 1);
- context->last_error_extra_info[sizeof(message)-1] = '\0';
+ strncpy(context->last_error_extra_info, error_message, sizeof(context->last_error_extra_info) - 1);
+ context->last_error_extra_info[sizeof(context->last_error_extra_info)-1] = '\0';
if (context->error_report_function != NULL)
{
--
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