Skip to content

Conversation

martinhsv
Copy link
Contributor

No description provided.

@martinhsv martinhsv merged commit 7b1cf0e into owasp-modsecurity:v3/master Apr 11, 2023

node->count++;
node->netmasks = reinterpret_cast<unsigned char *>(malloc(node->count * sizeof(unsigned char)));
memset(node->netmasks, 0, (node->count * sizeof(unsigned char)));
Copy link
Contributor

Choose a reason for hiding this comment

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

@martinhsv This memset should probably go below the null check 2 lines down. Same for the other 2 in this PR.

node->count++;
new_node = node;
node->netmasks = reinterpret_cast<unsigned char *>(malloc(node->count * sizeof(unsigned char)));
memset(node->netmasks, 0, (node->count * sizeof(unsigned char)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Here is another potential crash if we are out of memory. Malloc above may return null and there is no check below for this condition.

@martinhsv
Copy link
Contributor Author

Thanks @mirkodziadzka-avi . The location of the first memset has been corrected via #2891

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