Skip to content

Commit

Permalink
buffer overflow patched (#251)
Browse files Browse the repository at this point in the history
Thank you for the PR
  • Loading branch information
locus-x64 authored Feb 29, 2024
1 parent 355ddf9 commit c47f781
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/rule.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,8 +880,10 @@ zlog_rule_t *zlog_rule_new(char *line,
}
break;
case '$' :
sscanf(file_path + 1, "%s", a_rule->record_name);

// read only MAXLEN_PATH characters from the file_path + 1
strncpy(a_rule->record_name, file_path + 1, MAXLEN_PATH);
a_rule->record_name[MAXLEN_PATH] = '\0';

if (file_limit) { /* record path exists */
p = strchr(file_limit, '"');
if (!p) {
Expand Down

0 comments on commit c47f781

Please # to comment.