megamarc / Tilengine

Free 2D graphics engine with raster effects for retro/classic style game development
https://www.tilengine.org
Mozilla Public License 2.0
847 stars 95 forks source link

TLN_SetLoadPath Doesn't Check The Length Of Input Before Copying It To A Fixed Buffer #26

Closed bhelyer closed 6 years ago

bhelyer commented 6 years ago

The code in question.

The buffer is a fixed size stack variable, and the code just strcpy's it in there, without checking the length. In regular use, I imagine this will never come up (as 255 must be approaching Windows maximum path length), but maybe someone exposes this to users (perhaps to allow mods) and then this is suddenly a vulnerability vector (someone downloads a malicious mod that can suddenly run arbitrary code). A longshot I know, but I'd feel wrong not pointing it out, even if it is a bit nitpicky.