Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KVM: s390: Replace sprintf with snprintf for buffer safety

Replace sprintf() with snprintf() when formatting debug names to prevent
potential buffer overflow. The debug_name buffer is 16 bytes, and while
unlikely to overflow with current PIDs, using snprintf() provides proper
bounds checking.

Signed-off-by: Josephine Pfeiffer <hi@josie.lol>
[frankja@linux.ibm.com: Fixed subject prefix]
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>

authored by

Josephine Pfeiffer and committed by
Janosch Frank
f5a6fa18 7d5136ed

+1 -1
+1 -1
arch/s390/kvm/kvm-s390.c
··· 3348 3348 if (!kvm->arch.sca) 3349 3349 goto out_err; 3350 3350 3351 - sprintf(debug_name, "kvm-%u", current->pid); 3351 + snprintf(debug_name, sizeof(debug_name), "kvm-%u", current->pid); 3352 3352 3353 3353 kvm->arch.dbf = debug_register(debug_name, 32, 1, 7 * sizeof(long)); 3354 3354 if (!kvm->arch.dbf)