diff options
| author | Heiko Carstens <hca@linux.ibm.com> | 2025-10-07 11:05:04 +0200 |
|---|---|---|
| committer | Heiko Carstens <hca@linux.ibm.com> | 2025-10-21 10:17:30 +0200 |
| commit | c769941de8bf6ab744bbc7ec7a88c32955d10646 (patch) | |
| tree | 9c3c0c14193ed553421023d0bcaa18de2e7cde9b | |
| parent | ffb5d3af5e2b52472f236f8bb13414c7fab99797 (diff) | |
s390/tape: Use scnprintf() instead of sprintf()
Use scnprintf() instead of sprintf() for those cases where the destination
is an array and the size of the array is known at compile time.
This prevents theoretical buffer overflows, but also avoids that people
again and again spend time to figure out if the code is actually safe.
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Jan Polensky <japo@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
| -rw-r--r-- | drivers/s390/char/tape_char.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index 89778d922d9f..058a3b95f959 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c @@ -64,7 +64,7 @@ tapechar_setup_device(struct tape_device * device) { char device_name[20]; - sprintf(device_name, "ntibm%i", device->first_minor / 2); + scnprintf(device_name, sizeof(device_name), "ntibm%i", device->first_minor / 2); device->nt = register_tape_dev( &device->cdev->dev, MKDEV(tapechar_major, device->first_minor), |
