Bug #2161 » 0002-savegame-Fix-Heap-Buffer-Overflow-in-worklist_load.patch
| server/savegame/savegame2.c | ||
|---|---|---|
|
worklist_init(pwl);
|
||
|
pwl->length = secfile_lookup_int_default(file, 0,
|
||
|
"%s.wl_length", path_str);
|
||
|
if (pwl->length > MAX_LEN_WORKLIST) {
|
||
|
log_sg("worklist length %d, while MAX_LEN_WORKLIST %d.",
|
||
|
pwl->length, MAX_LEN_WORKLIST);
|
||
|
pwl->length = MAX_LEN_WORKLIST;
|
||
|
} else if (pwl->length > wlist_max_length) {
|
||
|
log_sg("worklist length %d, while player's max worklist length %d.",
|
||
|
pwl->length, wlist_max_length);
|
||
|
}
|
||
|
for (i = 0; i < pwl->length; i++) {
|
||
|
kind = secfile_lookup_str(file, "%s.wl_kind%d", path_str, i);
|
||
| server/savegame/savegame3.c | ||
|---|---|---|
|
worklist_init(pwl);
|
||
|
pwl->length = secfile_lookup_int_default(file, 0,
|
||
|
"%s.wl_length", path_str);
|
||
|
if (pwl->length > MAX_LEN_WORKLIST) {
|
||
|
log_sg("worklist length %d, while MAX_LEN_WORKLIST %d.",
|
||
|
pwl->length, MAX_LEN_WORKLIST);
|
||
|
pwl->length = MAX_LEN_WORKLIST;
|
||
|
} else if (pwl->length > wlist_max_length) {
|
||
|
log_sg("worklist length %d, while player's max worklist length %d.",
|
||
|
pwl->length, wlist_max_length);
|
||
|
}
|
||
|
for (i = 0; i < pwl->length; i++) {
|
||
|
kind = secfile_lookup_str(file, "%s.wl_kind%d", path_str, i);
|
||