mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-30 21:55:56 +00:00
fix(userspace/falco): right boundary checks for strncat
Co-authored-by: Federico Di Pierro <nierro92@gmail.com> Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
parent
75720534d7
commit
b40a6bc703
@ -250,7 +250,7 @@ void stats_writer::collector::get_metrics_output_fields_additional(
|
||||
for(uint32_t stat = 0; stat < nstats; stat++)
|
||||
{
|
||||
char metric_name[STATS_NAME_MAX] = "falco.";
|
||||
strncat(metric_name, utilization[stat].name, sizeof(metric_name) - strlen(metric_name));
|
||||
strncat(metric_name, utilization[stat].name, sizeof(metric_name) - strlen(metric_name) - 1);
|
||||
switch(utilization[stat].type)
|
||||
{
|
||||
case STATS_VALUE_TYPE_U64:
|
||||
@ -313,7 +313,7 @@ void stats_writer::collector::get_metrics_output_fields_additional(
|
||||
// todo: as we expand scap_stats_v2 prefix may be pushed to scap or we may need to expand
|
||||
// functionality here for example if we add userspace syscall counters that should be prefixed w/ `falco.`
|
||||
char metric_name[STATS_NAME_MAX] = "scap.";
|
||||
strncat(metric_name, stats_v2[stat].name, sizeof(metric_name) - strlen(metric_name));
|
||||
strncat(metric_name, stats_v2[stat].name, sizeof(metric_name) - strlen(metric_name) - 1);
|
||||
switch(stats_v2[stat].type)
|
||||
{
|
||||
case STATS_VALUE_TYPE_U64:
|
||||
|
Loading…
Reference in New Issue
Block a user