El 06/05/14 20:28, Jan Engelhardt escribió:
On Wednesday 2014-05-07 01:31, Cristian Rodríguez wrote:
Suppose I have a large body of code, of which programmers are
lazy and do something like this:
$ cat lazy.c int printf(const char *format, ...); int main(void)
{ printf("Problem?"); return 0; }
and the resulting code calls ..call printf .. instead of call
__printf_chk .. as it would when is included.
__printf_chk is called. The presence of a redundant identical
function declarations/prototypes does not change the program
behavior.
Ok, let me throw in another example ..
#include
char *strcpy(char *dest, const char *src);
int main(void)
{
char c[3];
strcpy(c, "fuuuuuuuuuuuuuuuuuuuuuuuuuckme");
printf("%s", c);
return 0;
}
This is valid but obviously buggy on purpose..
with included I get the obvious warning..
In function ‘strcpy’,
inlined from ‘main’ at c.c:10:5:
/usr/include/bits/string3.h:104:3: warning: call to
__builtin___memcpy_chk will always overflow destination buffer
return __builtin___strcpy_chk (__dest, __src, __bos (__dest));
No and the compiler is silent though the program still
crashes. this is more in line with the actual concern I have.
--
Cristian
"I don't know the key to success, but the key to failure is trying to
please everybody."
--
To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org
To contact the owner, e-mail: opensuse-factory+owner@opensuse.org