How do I prevent a char pointer buffer overflow?

Posted by Tommy on Stack Overflow See other posts from Stack Overflow or by Tommy
Published on 2010-05-11T00:52:42Z Indexed on 2010/05/11 1:04 UTC
Read the original article Hit count: 244

Filed under:
|
|
|

i.e. -

function(char* txt)
{
   sprintf(txt, "select * from %s;", table);
   //How do I set last char in buffer to NULL here?
}

so if the text in table some how was 500 chars long and txt in the main was only defined as 100....

thanks.

© Stack Overflow or respective owner

Related posts about c

    Related posts about pointers