commit 17a1a7fa8825604d2f6c6cd61889ef2c2fcc277c parent 1a1715c0f563ebe7825941808549666f4fe73a0e Author: Michael Savage <mikejsavage@gmail.com> Date: Sat Sep 10 18:13:31 -0700 Check the path fits Diffstat:
terrain_manager.cc | | | 6 | +++--- |
diff --git a/terrain_manager.cc b/terrain_manager.cc @@ -145,9 +145,9 @@ void terrain_init( for( u32 ty = 0; ty < tm->height / TILE_SIZE; ty++ ) { for( u32 tx = 0; tx < tm->width / TILE_SIZE; tx++ ) { char tile_path[ 256 ]; - // TODO: make sure this fits - sprintf( tile_path, "%s/%d_%d.lz4", - tiles_dir, tx, ty ); + // TODO: check this conversion + size_t written = sprintf( tile_path, "%s/%d_%d.lz4", tiles_dir, tx, ty ); + assert( written + 1 < sizeof( tile_path ) ); size_t len; u8 * data = file_get_contents( tile_path, &len );