linux/arch/s390
Peter Oberparleiter 5c95bf2746 s390/cert_store: fix string length handling
Building cert_store.o with W=1 reveals this bug:

        CC      arch/s390/kernel/cert_store.o
          arch/s390/kernel/cert_store.c:443:45: warning: ‘sprintf’ may write a terminating nul past the end of the destination [-Wformat-overflow=]
            443 |         sprintf(desc + name_len, ":%04u:%08u", vce->vce_hdr.vc_index, cs_token);
                |                                             ^
          arch/s390/kernel/cert_store.c:443:9: note: ‘sprintf’ output between 15 and 18 bytes into a destination of size 15
            443 |         sprintf(desc + name_len, ":%04u:%08u", vce->vce_hdr.vc_index, cs_token);

Fix this by using the correct maximum width for each integer component
in both buffer length calculation and format string. Also switch to
using snprintf() to guard against potential future changes to the
integer range of each component.

Fixes: 8cf57d7217 ("s390: add support for user-defined certificates")
Reported-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
2023-09-19 13:25:44 +02:00
..
appldata sysctl: Add size to register_sysctl 2023-08-15 15:26:17 -07:00
boot s390/mm: simplify kernel mapping setup 2023-08-30 11:03:27 +02:00
configs s390: update defconfigs 2023-09-19 13:25:44 +02:00
crypto s390/paes: fix PKEY_TYPE_EP11_AES handling for secure keyblobs 2023-08-17 15:18:53 +02:00
hypfs s390 updates for 6.6 merge window 2023-08-28 17:22:39 -07:00
include ARM: 2023-09-07 13:52:20 -07:00
kernel s390/cert_store: fix string length handling 2023-09-19 13:25:44 +02:00
kvm ARM: 2023-09-07 13:52:20 -07:00
lib s390: replace #include <asm/export.h> with #include <linux/export.h> 2023-08-09 15:20:50 +02:00
mm ARM: 2023-09-07 13:52:20 -07:00
net s390/bpf: Pass through tail call counter in trampolines 2023-09-06 10:48:14 +02:00
pci - Some swap cleanups from Ma Wupeng ("fix WARN_ON in add_to_avail_list") 2023-08-29 14:25:26 -07:00
purgatory s390 updates for 6.5 merge window part 2 2023-07-06 13:18:30 -07:00
tools KVM: s390: Add facility 197 to the allow list 2022-07-13 15:25:25 +02:00
Kbuild - An extensive rework of kexec and crash Kconfig from Eric DeVolder 2023-08-29 14:53:51 -07:00
Kconfig Add x86 shadow stack support 2023-08-31 12:20:12 -07:00
Kconfig.debug
Makefile s390: use obj-y to descend into drivers/s390/ 2023-07-24 12:12:25 +02:00