arthmoor / smaugfuss Goto Github PK
View Code? Open in Web Editor NEWFixed Up Smaug Source by the FUSS Project at SmaugMuds
Home Page: https://smaugmuds.afkmods.com/
Fixed Up Smaug Source by the FUSS Project at SmaugMuds
Home Page: https://smaugmuds.afkmods.com/
http://c-faq.com/stdio/getcharc.html
Apparently it's somewhat common for people to try to run SmaugFUSS on ARM devices like Raspberry Pis, which have unsigned chars, not signed chars, and then get confused when it sort of looks like it's working but then errors in weird ways.
If char is unsigned, then code like
Lines 2461 to 2466 in b76ca68
overruns its buffer, because fgetc returns an int, not a char, which then gets converted from signed -1 to unsigned 255, and EOF is -1, which means the comparison always fails.
See also https://www.raspberrypi.org/forums/viewtopic.php?t=217769
Based purely on visual inspection of the code, various places in weather.c
appear to read and write past the end of the weatherMap
storage.
I think
Lines 3086 to 3096 in d86556c
if( x < 0 || x >= WEATHER_SIZE_X )
{
ch_printf( ch, "X value must be between 0 and %d.\r\n", WEATHER_SIZE_X-1 );
return;
}
if( y < 0 || y >= WEATHER_SIZE_Y )
{
ch_printf( ch, "Y value must be between 0 and %d.\r\n", WEATHER_SIZE_Y-1 );
return;
}
and
Lines 752 to 753 in d86556c
x = number_range( 0, WEATHER_SIZE_X-1 );
y = number_range( 0, WEATHER_SIZE_Y-1 );
Several places in the Makefile invoke -fsanitize=address
but I don't think Cygwin has libasan so this causes build errors.
In #2 I mentioned
Lines 2461 to 2466 in b76ca68
char BUFF[MAX_STRING_LENGTH * 2];
. SmaugFUSS often does this in the context of reading file contents, but if the file is larger than MAX_STRING_LENGTH*2, the linked code will smash through the end of that buffer. It would be safer to make the buffer the actual size of the contents it's supposed to hold.
(Also, what does it mean for a string to be twice the max length? Isn't the max length then not the max?)
Now you could say "that file should never be so large", and maybe, but some of the people who are trying to run SmaugFUSS don't know what that means, and some may even unwittingly modify MAX_STRING_LENGTH to be smaller.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.