Sources Bugzilla – Bug 12445
printf() stack corruption in case of positional parameters + many format specs
Last modified: 2011-02-20 13:01:37 UTC
Created attachment 5215 [details] proposed patch A seldom-used code branch in vfprintf causes stack corruption in this (minimal) testcase: #include <stdio.h> int main() { printf ("\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d" "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%", "a", "b", "c", "d", 5); return 0; }
I checked in a patch and a test case.