Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Development
Nov 28, 2018, 10:10 am
By Keirath
First Immortal
Oct 12, 2018, 12:02 pm
By GatewaySysop
Bug in do_climb( )
Jun 5, 2018, 5:31 pm
By joeyfogas
question on overland code
May 31, 2018, 10:03 am
By joeyfogas
KaVir's Protocol Snip
May 15, 2018, 7:57 pm
By joeyfogas
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, DotBot, Bing

Members: 0
Guests: 35
Stats
Files
Topics
Posts
Members
Newest Member
481
3,740
19,397
633
Rhyader
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SmaugFUSS Bugfix List » [Bug] Calls to the *printf wr...
Forum Rules | Mark all | Recent Posts

[Bug] Calls to the *printf wrapper functions have unsafe formatting
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Mar 5, 2005, 3:56 pm   Last edited May 11, 2005, 6:35 pm by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,644
JoinedJan 1, 2002

Bug: Calls to the *printf wrapper functions, and in some cases to the *Printf functions are being made improperly.
Danger: High
Found by: Druid
Fixed by: Druid
-----
When using any printf function you should be inputting three arguments at the very least. The data variable, the format string, and the data that fits into the format string.

For example, the below usages.

Wrong:
sprintf( buf, "Data here!" );

Right:
sprintf( buf, "%s", "Data here!" );

The reason for this is when those functions are used (ch_printf and pager_printf, etc) along with user input they can slip in some format tokens (%s %c %d) causing major havoc with the game.

If you want to test it, have someone send you a tell with a string of %s tokens tacked together then use the repeat command. This can be used in some places that will cause crashing of the game.

The best thing to do is to go in and fix in code that wraps into a printf function to use the proper number of arguments. The bug and log function calls are particularly bad about it. Unless you need to input data into a string, use the send_to_char and sent_to_pager function, instead of ch_printf and ch_printf color.
       
Pages:<< prev 1 next >>