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

analysisd: fix heap overflow in rootkit decoder. #1825

Merged
merged 1 commit into from
Jan 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/analysisd/decoders/rootcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static FILE *RK_File(const char *agent, int *agent_id)
int i = 0;
char rk_buf[OS_SIZE_1024 + 1];

while (rk_agent_ips[i] != NULL) {
while (i < MAX_AGENTS && rk_agent_ips[i] != NULL) {
if (strcmp(rk_agent_ips[i], agent) == 0) {
/* Pointing to the beginning of the file */
fseek(rk_agent_fps[i], 0, SEEK_SET);
Expand All @@ -67,6 +67,12 @@ static FILE *RK_File(const char *agent, int *agent_id)
i++;
}

/* If here, our agent wasn't found */
if (i == MAX_AGENTS) {
merror("%s: Unable to open rootcheck file. Increase MAX_AGENTS.", ARGV0);
return (NULL);
}

/* If here, our agent wasn't found */
rk_agent_ips[i] = strdup(agent);

Expand Down