Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Google, Bing

Members: 0
Guests: 18
Stats
Files
Topics
Posts
Members
Newest Member
479
3,708
19,242
614
BenitoVirg
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,639
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 >>