From: Geert Uytterhoeven Date: Sat, 29 Sep 2012 20:23:19 +0000 (+0200) Subject: sysfs: sysfs_pathname/sysfs_add_one: Use strlcat() instead of strcat() X-Git-Tag: v3.7-rc3~14^2~4 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66081a72517a131430dcf986775f3268aafcb546;p=pandora-kernel.git 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 Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed