Fix invalid access reading demos

Casting the address of a short to `sbyte*` invites trouble.  In this
case, it allows uninitialized garbage to be used as the high bits of the
wall index.

Fixes: 553b313099 ("Use vwallptr")
This commit is contained in:
Kp 2016-02-14 18:40:57 +00:00
parent 081e5d5e3c
commit e36abb25cb

View file

@ -2959,8 +2959,10 @@ static int newdemo_read_frame_information(int rewrite)
wallnum_t back_wall_num, front_wall_num;
short l0,l1,l2,l3;
nd_read_byte((sbyte*)&front_wall_num);
nd_read_byte((sbyte*)&back_wall_num);
nd_read_byte(&type);
front_wall_num = type;
nd_read_byte(&type);
back_wall_num = type;
nd_read_byte(&type);
nd_read_byte(&state);
nd_read_byte(&cloak_value);