mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
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>
This commit is contained in:
committed by
Janosch Frank
parent
7d5136ed1b
commit
f5a6fa189a
@@ -3348,7 +3348,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
|
||||
if (!kvm->arch.sca)
|
||||
goto out_err;
|
||||
|
||||
sprintf(debug_name, "kvm-%u", current->pid);
|
||||
snprintf(debug_name, sizeof(debug_name), "kvm-%u", current->pid);
|
||||
|
||||
kvm->arch.dbf = debug_register(debug_name, 32, 1, 7 * sizeof(long));
|
||||
if (!kvm->arch.dbf)
|
||||
|
||||
Reference in New Issue
Block a user