Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » sprintf
sprintf [message #306471] Sat, 29 December 2007 11:07 Go to next message
cnc95fan is currently offline  cnc95fan
Messages: 1261
Registered: July 2007
Karma: 0
General (1 Star)
Hi, theres no real way as to how to find out (as a newb) how the sprintf function works.. If anyone here wouldn't mind explaining, I'de like to know for a coustom script I'm trying to make.
Thanks in advance.
Re: sprintf [message #306484 is a reply to message #306471] Sat, 29 December 2007 12:57 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Google is your friend.

http://www.cplusplus.com/reference/clibrary/cstdio/sprintf.html

Wow, easy isn't it? Rocked Over


http://steamsignature.com/card/1/76561197975867233.png
Re: sprintf [message #306491 is a reply to message #306471] Sat, 29 December 2007 13:02 Go to previous messageGo to next message
Sir Kane
Messages: 1701
Registered: March 2003
Location: Angerville
Karma: 0
General (1 Star)
MSDN.

Proud N9500 and proud N6270 user. Creator of the IEE libraries (original bhs.dll) and the RB series software.
http://n00bstories.com/image.fetch.php?id=1189992501http://www.n00bstories.com/image.fetch.php?id=1257492907
Re: sprintf [message #306494 is a reply to message #306471] Sat, 29 December 2007 13:19 Go to previous messageGo to next message
cnc95fan is currently offline  cnc95fan
Messages: 1261
Registered: July 2007
Karma: 0
General (1 Star)
Oo, I thought it was defined in a header file... Thanks danpaul.. and Sir_Kane
Re: sprintf [message #306519 is a reply to message #306471] Sat, 29 December 2007 17:21 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
stdio.h
Re: sprintf [message #306529 is a reply to message #306471] Sat, 29 December 2007 17:49 Go to previous messageGo to next message
=HT=T-Bird is currently offline  =HT=T-Bird
Messages: 712
Registered: June 2005
Karma: 0
Colonel
NEVER NEVER NEVER pass any string that is created from user input to printf() and friends as a format string, otherwise you'd have a security hole on your hands Surprised

HTT-Bird (IRC)
HTTBird (WOL)
Proud HazTeam Lieutenant.
BlackIntel Coder & Moderator.

If you have trouble running BIATCH on your FDS, have some questions about a BIATCH message or log entry, or think that BIATCH spit out a false positive, PLEASE contact the BlackIntel coding team and avoid wasting the time of others.
Re: sprintf [message #306533 is a reply to message #306529] Sat, 29 December 2007 18:41 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
=HT=T-Bird wrote on Sun, 30 December 2007 00:49

NEVER NEVER NEVER pass any string that is created from user input to printf() and friends as a format string, otherwise you'd have a security hole on your hands Surprised


You'd never do that anyway, asking the user to input a format string is too much these days.

[Updated on: Sat, 29 December 2007 18:41]

Report message to a moderator

Re: sprintf [message #306534 is a reply to message #306471] Sat, 29 December 2007 18:49 Go to previous messageGo to next message
cnc95fan is currently offline  cnc95fan
Messages: 1261
Registered: July 2007
Karma: 0
General (1 Star)
Wow, maybe I should go and re-learn the basics of c++ again. Razz
Re: sprintf [message #306536 is a reply to message #306529] Sat, 29 December 2007 18:55 Go to previous messageGo to next message
Sir Kane
Messages: 1701
Registered: March 2003
Location: Angerville
Karma: 0
General (1 Star)
=HT=T-Bird wrote on Sat, 29 December 2007 18:49

NEVER NEVER NEVER pass any string that is created from user input to printf() and friends as a format string, otherwise you'd have a security hole on your hands Surprised

You mean don't pass it as format string.


Proud N9500 and proud N6270 user. Creator of the IEE libraries (original bhs.dll) and the RB series software.
http://n00bstories.com/image.fetch.php?id=1189992501http://www.n00bstories.com/image.fetch.php?id=1257492907
Re: sprintf [message #306619 is a reply to message #306471] Sun, 30 December 2007 03:50 Go to previous messageGo to next message
cnc95fan is currently offline  cnc95fan
Messages: 1261
Registered: July 2007
Karma: 0
General (1 Star)
There needs to be a coding forum here Wink
Re: sprintf [message #306627 is a reply to message #306471] Sun, 30 December 2007 05:36 Go to previous messageGo to next message
Sir Kane
Messages: 1701
Registered: March 2003
Location: Angerville
Karma: 0
General (1 Star)
And you might want to use _snprintf instead.

Proud N9500 and proud N6270 user. Creator of the IEE libraries (original bhs.dll) and the RB series software.
http://n00bstories.com/image.fetch.php?id=1189992501http://www.n00bstories.com/image.fetch.php?id=1257492907
Re: sprintf [message #306630 is a reply to message #306627] Sun, 30 December 2007 06:34 Go to previous message
=HT=T-Bird is currently offline  =HT=T-Bird
Messages: 712
Registered: June 2005
Karma: 0
Colonel
Sir Kane wrote on Sun, 30 December 2007 06:36

And you might want to use _snprintf instead.

Good idea SK, we don't want anyone overflowing any buffers either Smile


HTT-Bird (IRC)
HTTBird (WOL)
Proud HazTeam Lieutenant.
BlackIntel Coder & Moderator.

If you have trouble running BIATCH on your FDS, have some questions about a BIATCH message or log entry, or think that BIATCH spit out a false positive, PLEASE contact the BlackIntel coding team and avoid wasting the time of others.
Previous Topic: A couple of models
Next Topic: Re-arenaging the menus..
Goto Forum:
  


Current Time: Fri Dec 20 10:36:14 MST 2024

Total time taken to generate the page: 0.00840 seconds