Monday, April 04, 2005

The monk is culprit

While going through the SunOS strcat manual, I was stuck by the following lines.


Buffer overflow can be checked as follows:
if (strlcat(dst, src, dstsize) >= dstsize)
return -1;



What is wrong with it?

1 comment:

SG said...

This will check correctly only if the size of dest is greater than or equal to one less than dstSize.