empserver/include
Markus Armbruster 002a3a3f1e xundump: Refuse to undump strings too long for terminating null
We're dealing with three kinds of string storage: char * pointing to a
null-terminated string, char[] holding a null-terminated string, and
char holding a string of length 0 or 1.

Unfortunately, xdump meta data doesn't distinguish the latter two:
both are NSC_STRINGY.  Because of that, xundump happily fills char[]
to the limit, producing strings that aren't null-terminated, resulting
in read beyond buffer and possibly worse.

Affects struct shpstr members shp_path, shp_name, shp_rpath, struct
lndstr member lnd_rpath, and struct natstr members nat_cnam, nat_pnam,
nat_hostaddr, nat_hostname, nat_userid.  Since these are all in game
state, only the empdump utility program is affected, not the
configuration table reader.

We clearly need to require null-termination for char[] values.  Since
using char[1] for null-terminated strings makes no sense, we can still
make NSC_STRINGY with length 1 serve char values as before, by
permitting non-null-terminated strings only when length is 1.  Ugly
wart, but it fixes the bug without a possibly awkward change xdump
meta-data.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-01 16:52:58 +01:00
..
actofgod.h Clean up superfluous includes 2014-02-16 13:19:26 +01:00
budg.h Update copyright notice 2014-01-02 14:33:48 +01:00
chance.h Fix PRNG seeding to resist guessing 2013-05-08 06:55:21 +02:00
com.h Update copyright notice 2014-01-02 14:33:48 +01:00
combat.h Remove option TREATIES 2014-02-16 11:44:14 +01:00
commands.h Update copyright notice 2014-01-02 14:33:48 +01:00
commodity.h Update copyright notice 2014-01-02 14:33:48 +01:00
damage.h Update copyright notice 2014-01-02 14:33:48 +01:00
distribute.h Update copyright notice 2014-01-02 14:33:48 +01:00
econfig-spec.h Remove option TREATIES 2014-02-16 11:44:14 +01:00
empio.h Update copyright notice 2014-01-02 14:33:48 +01:00
empobj.h Remove option TREATIES 2014-02-16 11:44:14 +01:00
empthread.h Update copyright notice 2014-01-02 14:33:48 +01:00
file.h Remove option TREATIES 2014-02-16 11:44:14 +01:00
game.h Update copyright notice 2014-01-02 14:33:48 +01:00
ioqueue.h Update copyright notice 2014-01-02 14:33:48 +01:00
item.h Update copyright notice 2014-01-02 14:33:48 +01:00
journal.h Update copyright notice 2014-01-02 14:33:48 +01:00
land.h subs: Rename lnd_delete() to lnd_put_one() 2015-01-17 15:25:24 +01:00
loan.h Update copyright notice 2014-01-02 14:33:48 +01:00
lost.h Update copyright notice 2014-01-02 14:33:48 +01:00
lwp.h Clean up superfluous includes 2014-02-16 13:19:26 +01:00
map.h Update copyright notice 2014-01-02 14:33:48 +01:00
match.h Update copyright notice 2014-01-02 14:33:48 +01:00
misc.h Update copyright notice 2014-01-02 14:33:48 +01:00
mission.h Update copyright notice 2014-01-02 14:33:48 +01:00
nat.h Remove option TREATIES 2014-02-16 11:44:14 +01:00
news.h Remove option TREATIES 2014-02-16 11:44:14 +01:00
nsc.h xundump: Refuse to undump strings too long for terminating null 2015-02-01 16:52:58 +01:00
nuke.h Update copyright notice 2014-01-02 14:33:48 +01:00
optlist.h Update copyright notice 2014-01-02 14:33:48 +01:00
path.h path: New DIR_BACK() 2014-02-16 12:00:18 +01:00
plague.h Update copyright notice 2014-01-02 14:33:48 +01:00
plane.h Update copyright notice 2014-01-02 14:33:48 +01:00
player.h tests: New test-suite-only command __cmd 2014-01-19 10:16:24 +01:00
power.h Update copyright notice 2014-01-02 14:33:48 +01:00
product.h Update copyright notice 2014-01-02 14:33:48 +01:00
proto.h Update copyright notice 2014-01-02 14:33:48 +01:00
prototypes.h trade: Clean up type of trdswitchown()'s second parameter 2014-02-16 13:19:27 +01:00
queue.h Update copyright notice 2014-01-02 14:33:48 +01:00
retreat.h retreat: Move function declarations to retreat.h 2014-02-16 13:19:26 +01:00
sect.h shpsub: Make shp_check_nav() return more useful information 2014-02-16 13:19:25 +01:00
server.h Update copyright notice 2014-01-02 14:33:48 +01:00
service.h Update copyright notice 2014-01-02 14:33:48 +01:00
ship.h subs: Rename shp_put() to shp_nav_put() 2015-01-17 15:25:24 +01:00
tel.h Update copyright notice 2014-01-02 14:33:48 +01:00
testing.h tests: New test-suite-only command __cmd 2014-01-19 10:16:24 +01:00
trade.h Update copyright notice 2014-01-02 14:33:48 +01:00
types.h shpsub: Make shp_check_nav() return more useful information 2014-02-16 13:19:25 +01:00
unit.h subs: Split unit_put() into shp_put() and lnd_put() again 2015-01-17 15:25:16 +01:00
update.h Update copyright notice 2014-01-02 14:33:48 +01:00
version.h Update copyright notice 2014-01-02 14:33:48 +01:00
xdump.h Update copyright notice 2014-01-02 14:33:48 +01:00
xy.h Update copyright notice 2014-01-02 14:33:48 +01:00