Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 Couple bugs
Yesterday, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!, DotBot

Members: 0
Guests: 15
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
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 >>