Sign in to follow this  
Followers 0

overflowable buffer in eternity

found this in c_io.c C_Printf.

unsigned char tempstr[10240];
...
vsprintf(tempstr, s, args);

this could cause an overflow, but this is easily fixed by using
vsnprintf(tempstr, 10240, s, args) instead.

Share this post


Link to post

My fault :P

And dont you mean

vsnprintf(tempstr, 10239, s, args)

Share this post


Link to post

no, it will take the size of the buffer, it will leave room for the zero automagicaly.

Share this post


Link to post

oh, and the retards at ms, who like to complicate things call it _vsnprintf instead.

Share this post


Link to post

#ifdef __MSVC__
#define vsnprintf _vsnprintf
#endif

or something similar

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0