]> Git Repo - linux.git/commit - fs/sysfs/dir.c
sysfs: sysfs_pathname/sysfs_add_one: Use strlcat() instead of strcat()
authorGeert Uytterhoeven <[email protected]>
Sat, 29 Sep 2012 20:23:19 +0000 (22:23 +0200)
committerGreg Kroah-Hartman <[email protected]>
Wed, 24 Oct 2012 22:57:14 +0000 (15:57 -0700)
commit66081a72517a131430dcf986775f3268aafcb546
tree4ca237f799ac01827ff8bb55cf388121b7d14f9e
parentc0d2af637863940b1a4fb208224ca7acb905c39f
sysfs: sysfs_pathname/sysfs_add_one: Use strlcat() instead of strcat()

The warning check for duplicate sysfs entries can cause a buffer overflow
when printing the warning, as strcat() doesn't check buffer sizes.
Use strlcat() instead.

Since strlcat() doesn't return a pointer to the passed buffer, unlike
strcat(), I had to convert the nested concatenation in sysfs_add_one() to
an admittedly more obscure comma operator construct, to avoid emitting code
for the concatenation if CONFIG_BUG is disabled.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Cc: [email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
fs/sysfs/dir.c
This page took 0.052802 seconds and 4 git commands to generate.