Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix buffer owerflow in the function parseVariant #6335

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DmitriyFedin
Copy link

variant[0] can have a maximum value of 72. field->var = variant0 - VAR_MIN;, so a maximum value field->var = 7

This is a buffer overflow in the line
obj->var[field->var] = (char *)malloc(MAX_FILTER)

if it accesses the array at index 7, an overflow will occur.

Found by Linux Verification Center (linuxtesting.org) with SVACE.
Reporter: Dmitriy Fedin (d.fedin@fobos-nt.ru).

`variant[0]` can have a maximum value of 72. `field->var = variant0 - VAR_MIN;`, so  a maximum value `field->var = 7`


This is a buffer overflow in the line
 `obj->var[field->var] = (char *)malloc(MAX_FILTER)`

if it accesses the array at index 7, an overflow will occur.
Copy link
Contributor

@progier389 progier389 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry but I do not think that this fix is correct:
As the error message said, variable are expected to be within between VAR_MIN and VAR_MAX.
If there is a buffer overflow that is the array size that must be changed rather than limiting the variable range ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants