Skip to content

Commit

Permalink
Fix off-by-one NULL write (reported by Jurriaan Bremer)
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Manuel Alvarez committed Jul 5, 2017
1 parent 4a342f0 commit 964d6c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libyara/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ YR_OBJECT* _yr_object_lookup(
{
i = 0;

while(*p != '\0' && *p != '.' && *p != '[' && i < sizeof(str) - 1)
while (*p != '\0' && *p != '.' && *p != '[' && i < sizeof(str) - 1)
{
str[i++] = *p++;
}
Expand Down Expand Up @@ -487,7 +487,7 @@ YR_OBJECT* _yr_object_lookup(
i = 0;
p++; // skip the opening quotation mark

while (*p != '"' && *p != '\0' && i < sizeof(str))
while (*p != '"' && *p != '\0' && i < sizeof(str) - 1)
str[i++] = *p++;

str[i] = '\0';
Expand Down

0 comments on commit 964d6c0

Please sign in to comment.