Runtime buffer overflow checks

Bert Wesarg bert.wesarg at googlemail.com
Wed Oct 22 12:38:26 CEST 2008


Hi all,

I'm getting an buffer overflow error with recent GCC (ubuntu 4.3.2)
and -O3 optimization. The new cool feature is called _FORTIFY_SOURCE
(maybe). This checks at runtime buffer bounds within str*() and mem*()
functions. The problem that hits me is in regularExpr.c. The function
makeDelimiterTable() expects the second argument to be of type
'unsigned char[256]' but the declaration is only 'unsigned char *'.
memset() is that called with a length parameter of 256 and the
internal checks fails because the length of the arguments is not
known. If I declare this function with the 'unsigned char[256]' all
works as expected. The question I have now is: can all supported
platforms this syntax or is this purely my problem? I can disable
these checks with -U_FORTIFY_SOURCE.

Bert


More information about the Develop mailing list