Inline warnings

Posted by Robert Powell on Mon 26 Oct 2009 03:20 AM — 3 posts, 19,429 views.

Australia #0

/usr/include/bits/stdio2.h:79: warning: call to int __builtin___vsnprintf_chk(char*, unsigned int, int, unsigned int, const char*, char*) will always overflow destination buffer



void BufPrintf ( BUFFER * buffer, char * fmt, ... )
{
    char buf[MSL];
    va_list args;

    va_start ( args, fmt );
    vsnprintf ( buf, LBUF, fmt, args );
    va_end ( args );

    add_buf ( buffer, buf );
    return;
}


Ok, from what i can gather inline errors come up from using the wrong tool for the job, the others i have been able to fix myself, but i do not know what to do with this one, what should be used in this situation instead of vsnprintf.
USA #1
You need to make sure that you're using the right size. Why are you allocating a buffer of size MSL, but telling vsnprintf to use size LBUF? Basically, the compiler is telling you that this is guaranteed to fail, because it can see that LBUF is bigger than the size of buf, which is MSL.


By the way, what is the "inline warning" here?
Amended on Mon 26 Oct 2009 04:29 AM by David Haley
Australia #2
LOL yeah i posted the wrong warning and associated code, i will get to the inlines soon :)