selftests/tcp_ao: Fix fscanf() call for format-security
authorDmitry Safonov <0x7f454c46@gmail.com>
Sat, 13 Apr 2024 01:42:54 +0000 (02:42 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 16 Apr 2024 11:35:06 +0000 (13:35 +0200)
commitbeb78cd1329d039d73487ca05633d1b92e1ab2ea
tree6e1e56bacbacd1168a89cbc9acf10eaf07e5d750
parentb089b3bead532419cdcbd8e4e0a3e23c49d11573
selftests/tcp_ao: Fix fscanf() call for format-security

On my new laptop with packages from nixos-unstable, gcc 12.3.0 produces:
> lib/proc.c: In function ‘netstat_read_type’:
> lib/proc.c:89:9: error: format not a string literal and no format arguments [-Werror=format-security]
>    89 |         if (fscanf(fnetstat, type->header_name) == EOF)
>       |         ^~
> cc1: some warnings being treated as errors

Here the selftests lib parses header name, while expectes non-space word
ending with a column.

Fixes: cfbab37b3da0 ("selftests/net: Add TCP-AO library")
Signed-off-by: Dmitry Safonov <0x7f454c46@gmail.com>
Reported-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/net/tcp_ao/lib/proc.c