Log in

View Full Version : SprintF


provocating
11-27-2011, 04:36 PM
When did this start crapping out ? I am in my second day of C++ mental bombardment and reading old post I though this would work. Not exactly what I was trying to do, but right now just narrowing down my error.

sprintf("%c",0x12);

questmgr.cpp:1108: error: invalid conversion from âintâ to âconst char*â
questmgr.cpp:1108: error: initializing argument 2 of âint sprintf(char*, const char*, ...)â

provocating
11-27-2011, 05:20 PM
Nevermind, obviously I needed to RTFM.

daerath
12-04-2011, 02:36 PM
Nevermind, obviously I needed to RTFM.

At no point should you be using sprintf.

http://msdn.microsoft.com/en-us/library/bb288454.aspx

sprintf (and a host of other function calls) are at the root of essentially every buffer overflow.

banned.h and strsafe.h are your friends.

provocating
12-04-2011, 02:41 PM
Well I got it from questmgr.cpp

I just did a quick ctr-f and found a ton of them in there, /shrug.

In the end it did not matter, the code I added did not need it anyway.