Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ ROM ➜ Compiling the server ➜ Inline warnings

Inline warnings

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Robert Powell   Australia  (367 posts)  Bio
Date Mon 26 Oct 2009 03:20 AM (UTC)
Message

/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.

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Mon 26 Oct 2009 04:28 AM (UTC)

Amended on Mon 26 Oct 2009 04:29 AM (UTC) by David Haley

Message
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?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Robert Powell   Australia  (367 posts)  Bio
Date Reply #2 on Mon 26 Oct 2009 06:55 AM (UTC)
Message
LOL yeah i posted the wrong warning and associated code, i will get to the inlines soon :)

Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,984 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.