[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  ROM
. -> [Folder]  Compiling the server
. . -> [Subject]  Inline warnings
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Inline warnings

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Robert Powell   Australia  (367 posts)  [Biography] bio
Date Mon 26 Oct 2009 03:20 AM (UTC)  quote  ]
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.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio   Moderator
Date Reply #1 on Mon 26 Oct 2009 04:28 AM (UTC)  quote  ]

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
[Go to top] top

Posted by Robert Powell   Australia  (367 posts)  [Biography] bio
Date Reply #2 on Mon 26 Oct 2009 06:55 AM (UTC)  quote  ]
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.
[Go to top] 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.


2,428 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]