mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 23:09:29 +02:00
drivers/misc/enclosure: Replace strcpy() + strcat() with snprintf()
While the sizeof the target buffer is (should be) ENCLOSURE_NAME_SIZE and the copies should not overrrun this stops any static analysis objecting to the unbounded strcpy() and strcat() calls Signed-off-by: David Laight <david.laight.linux@gmail.com> Link: https://patch.msgid.link/20260608095523.2606-18-david.laight.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
61b101c6a1
commit
6994c8b4ef
@@ -184,8 +184,8 @@ EXPORT_SYMBOL_GPL(enclosure_unregister);
|
||||
|
||||
static void enclosure_link_name(struct enclosure_component *cdev, char *name)
|
||||
{
|
||||
strcpy(name, "enclosure_device:");
|
||||
strcat(name, dev_name(&cdev->cdev));
|
||||
snprintf(name, ENCLOSURE_NAME_SIZE, "enclosure_device:%s",
|
||||
dev_name(&cdev->cdev));
|
||||
}
|
||||
|
||||
static void enclosure_remove_links(struct enclosure_component *cdev)
|
||||
|
||||
Reference in New Issue
Block a user