From: Anders Kaseorg Date: Tue, 24 Mar 2009 20:41:55 +0000 (-0400) Subject: Staging: rt2870: Don't call sprintf() with overlapping input and output. X-Git-Tag: v2.6.31-rc1~105^2~219 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fefd5f6688deaaac96497426677ef1333b5982b;p=pandora-kernel.git Staging: rt2870: Don't call sprintf() with overlapping input and output. The use of sprintf() to append to a buffer, as in sprintf(buf, "%sEntry: %d\n", buf, i) is not valid according to C99 ("If copying takes place between objects that overlap, the behavior is undefined."). It breaks at least in userspace under gcc -D_FORTIFY_SOURCE. Replace this construct with sprintf(buf + strlen(buf), "Entry: %d\n", i) This patch was automatically generated using perl -0pe 's/(sprintf\s*\(\s*([^,]*))(\s*,\s*")%s((?:[^"\\]|\\.)*"\s*,)\s*\2\s*,/$1 + strlen($2)$3$4/g' perl -0pe 's/(snprintf\s*\(\s*([^,]*))(\s*,[^,]*?)(\s*,\s*")%s((?:[^"\\]|\\.)*"\s*,)\s*\2\s*,/$1 + strlen($2)$3 - strlen($2)$4$5/g' Signed-off-by: Anders Kaseorg Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed