Skip to content

Commit 5ef1b01

Browse files
David Laightaxboe
authored andcommitted
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>
1 parent 2dc0bfd commit 5ef1b01

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/block/rbd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3672,7 +3672,7 @@ static void __rbd_lock(struct rbd_device *rbd_dev, const char *cookie)
36723672
struct rbd_client_id cid = rbd_get_cid(rbd_dev);
36733673

36743674
rbd_dev->lock_state = RBD_LOCK_STATE_LOCKED;
3675-
strcpy(rbd_dev->lock_cookie, cookie);
3675+
strscpy(rbd_dev->lock_cookie, cookie);
36763676
rbd_set_owner_cid(rbd_dev, &cid);
36773677
queue_work(rbd_dev->task_wq, &rbd_dev->acquired_lock_work);
36783678
}

0 commit comments

Comments
 (0)