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.

s390/dasd: 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.

Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Jan Höppner and committed by
Jens Axboe
a857d992 43198756

+2 -1
+2 -1
drivers/s390/block/dasd_devmap.c
··· 355 355 /* each device in dasd= parameter should be set initially online */ 356 356 features |= DASD_FEATURE_INITIAL_ONLINE; 357 357 while (from <= to) { 358 - sprintf(bus_id, "%01x.%01x.%04x", from_id0, from_id1, from++); 358 + scnprintf(bus_id, sizeof(bus_id), 359 + "%01x.%01x.%04x", from_id0, from_id1, from++); 359 360 devmap = dasd_add_busid(bus_id, features); 360 361 if (IS_ERR(devmap)) { 361 362 rc = PTR_ERR(devmap);