Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 1 | From d84807ec6d6f8511e4ec939a745d4d7bb35c3cfb Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 4 Feb 2022 09:22:48 -0800 |
| 4 | Subject: [PATCH] tracers: Fix buffer overflow |
| 5 | |
| 6 | Fixes |
| 7 | | ../../../git/plugins/tracers/gstcpuusagecompute.c:106:9: error: 'fscanf' may overflow; destination buffer in argument 3 has size 8, but the corresponding specifier may require size 9 [-Werror,-Wfortify-sour |
| 8 | ce] |
| 9 | | cpu_name, &user[0], &nice[0], &system[0], &idle[0], &iowait, &irq, |
| 10 | | ^ |
| 11 | |
| 12 | Upstream-Status: Pending |
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 14 | --- |
| 15 | plugins/tracers/gstcpuusagecompute.c | 2 +- |
| 16 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 17 | |
| 18 | diff --git a/plugins/tracers/gstcpuusagecompute.c b/plugins/tracers/gstcpuusagecompute.c |
| 19 | index 39255fb..00bae66 100644 |
| 20 | --- a/plugins/tracers/gstcpuusagecompute.c |
| 21 | +++ b/plugins/tracers/gstcpuusagecompute.c |
| 22 | @@ -69,7 +69,7 @@ gst_cpu_usage_compute (GstCPUUsage * cpu_usage) |
| 23 | gint *idle; |
| 24 | gint *idle_aux; |
| 25 | |
| 26 | - gchar cpu_name[CPU_NAME_MAX_SIZE]; |
| 27 | + gchar cpu_name[CPU_NAME_MAX_SIZE+1]; |
| 28 | gint iowait; /* Time waiting for I/O to complete */ |
| 29 | gint irq; /* Time servicing interrupts */ |
| 30 | gint softirq; /* Time servicing softirqs */ |
| 31 | -- |
| 32 | 2.35.1 |
| 33 | |