mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
drivers/block/rbd: Use strscpy() to copy strings into arrays
Replacing strcpy() with strscpy() ensures than overflow of the target buffer cannot happen. Signed-off-by: David Laight <david.laight.linux@gmail.com> Reviewed-by: Alex Elder <elder@riscstar.com> Link: https://patch.msgid.link/20260606202744.5113-5-david.laight.linux@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
2dc0bfd2fe
commit
5ef1b0194b
|
|
@ -3672,7 +3672,7 @@ static void __rbd_lock(struct rbd_device *rbd_dev, const char *cookie)
|
|||
struct rbd_client_id cid = rbd_get_cid(rbd_dev);
|
||||
|
||||
rbd_dev->lock_state = RBD_LOCK_STATE_LOCKED;
|
||||
strcpy(rbd_dev->lock_cookie, cookie);
|
||||
strscpy(rbd_dev->lock_cookie, cookie);
|
||||
rbd_set_owner_cid(rbd_dev, &cid);
|
||||
queue_work(rbd_dev->task_wq, &rbd_dev->acquired_lock_work);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user