Replace questionable sprintf(buf, "%s...", buf, ...) pattern, which is broken by -D_FORTIFY_SOURCE. perl -pe 's/(sprintf\s*\(\s*([^,]*))(\s*,\s*")%s([^"]*"\s*,)\s*\2\s*,/\1 + strlen(\2)\3\4/g'