Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
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, Yandex, Bing

Members: 0
Guests: 14
Stats
Files
Topics
Posts
Members
Newest Member
481
3,737
19,381
619
Alexander
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Bugfix Lists » SmaugFUSS Bugfix List » [Bug] The setweather command ...
Forum Rules | Mark all | Recent Posts

[Bug] The setweather command will crash when negative values are used
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Mar 25, 2008, 12:16 pm   Last edited May 21, 2008, 5:50 pm by Samson
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,643
JoinedJan 1, 2002

Bug: The setweather command will crash when negative values are used
Danger: Critical - Game crash.
Found by: Llarn
Fixed by: Samson

---

weather.c, do_setweather

Locate:
	if( x < 1 && x > WEATHER_SIZE_X )
	{
		
		ch_printf( ch, "X value must be between 1 and %d.\r\n", WEATHER_SIZE_X );
		return;
	}	
		
	if( y < 1 && y > WEATHER_SIZE_Y )
	{
		
		ch_printf( ch, "Y value must be between 1 and %d.\r\n", WEATHER_SIZE_Y );
		return;
	}


Change to:
	if( x < 1 || x > WEATHER_SIZE_X - 1 )
	{
		
		ch_printf( ch, "X value must be between 1 and %d.\r\n", WEATHER_SIZE_X - 1 );
		return;
	}	
		
	if( y < 1 || y > WEATHER_SIZE_Y - 1 )
	{
		
		ch_printf( ch, "Y value must be between 1 and %d.\r\n", WEATHER_SIZE_Y - 1 );
		return;
	}


The two ifchecks were using the wrong logic. The x and y variables cannot be both smaller than 1 AND greater than the maximum value allowed at the same time, so in essence the code was allowing any value to be input. But the weather array doesn't accept negative or 0 values, which is what resulted in the crash.
       
Pages:<< prev 1 next >>