]> git.ipfire.org Git - thirdparty/collectd.git/commit
cpu plugin: Fix potential buffer overflow.
authorFlorian Forster <octo@collectd.org>
Tue, 28 Nov 2023 13:42:54 +0000 (14:42 +0100)
committerFlorian Forster <octo@collectd.org>
Wed, 29 Nov 2023 20:56:20 +0000 (21:56 +0100)
commit782de83be4c0658a5f64f030f33a397f01efbf4c
treef7b3181fab0476e4b52c6a4d5ca1d33c1611d44c
parentf95e356a303cfc56cb4b7033a9865d1e3e817d47
cpu plugin: Fix potential buffer overflow.

```
In function 'cpu_commit_without_aggregation',
    inlined from 'cpu_commit' at src/cpu.c:563:5,
    inlined from 'cpu_read' at src/cpu.c:925:3:
src/cpu.c:534:50: note: directive argument in the range [0, 18446744073709551614]
  534 |       snprintf(cpu_num_str, sizeof(cpu_num_str), "%zu", cpu_num);
      |                                                  ^~~~~
src/cpu.c:534:7: note: 'snprintf' output between 2 and 21 bytes into a destination of size 16
  534 |       snprintf(cpu_num_str, sizeof(cpu_num_str), "%zu", cpu_num);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
src/cpu.c