widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #04378
[Merge] lp:~widelands-dev/widelands/s2_map into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/s2_map into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/s2_map/+merge/272877
Changed string data types in S2MapDescrHeader to fixed char arrays to fix crash in map preload packet.
I just copied it over from Build 18 ;)
The crash was reported on the forum: https://wl.widelands.org/forum/topic/1471/
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/s2_map into lp:widelands.
=== modified file 'src/map_io/s2map.cc'
--- src/map_io/s2map.cc 2015-01-31 16:03:59 +0000
+++ src/map_io/s2map.cc 2015-09-30 07:57:07 +0000
@@ -48,14 +48,13 @@
namespace {
struct S2MapDescrHeader {
-
char magic[10]; // "WORLD_V1.0"
- std::string name;
+ char name [20]; // We need fixed char arrays rather than strings here. Otherwise, this will segfault.
int16_t w;
int16_t h;
int8_t uses_world; // 0 = green, 1 =black, 2 = winter
int8_t nplayers;
- std::string author;
+ char author[26];
char bulk[2290]; // unknown
} /* size 2352 */;
Follow ups