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

plugins/ocp: fix telemetry parser buffer overflow #2694

Merged
merged 1 commit into from
Feb 7, 2025
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
10 changes: 5 additions & 5 deletions util/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,18 @@ unsigned char *read_binary_file(char *data_dir_path, const char *bin_path,

void print_formatted_var_size_str(const char *msg, const __u8 *pdata, size_t data_size, FILE *fp)
{
char description_str[256] = "";
char description_str[1024] = "";
char temp_buffer[3] = { 0 };

for (size_t i = 0; i < data_size; ++i) {
sprintf(temp_buffer, "%02X", pdata[i]);
strcat(description_str, temp_buffer);
}

if (fp)
fprintf(fp, "%s: %s\n", msg, description_str);
else
printf("%s: %s\n", msg, description_str);
if (!fp)
fp = stdout;

fprintf(fp, "%s: %s\n", msg, description_str);
}

void process_field_size_16(int offset, char *sfield, __u8 *buf, char *datastr)
Expand Down