bounds checking by doname() and xname()

Try harder to prevent buffer overflow when formatting objects.
I don't have any test cases where overflow has been happening so
don't really know whether this works reliably.  And it doesn't try
to check prefix construction by doname().  [Yet?]
This commit is contained in:
PatR
2024-01-20 17:53:44 -08:00
parent 414ee6eba7
commit 7b1ec30d0d
3 changed files with 295 additions and 160 deletions

View File

@@ -1085,6 +1085,12 @@ struct instance_globals_x {
/* mkmaze.c */
int xmin, xmax; /* level boundaries x */
/* objnam.c */
char *xnamep; /* obuf[] returned by xname(), for use in doname() for
* bounds checking; differs from xname() return value
* due to reserving PREFIX bytes at start and possibly
* skipping leading "the " after constructing result */
/* sp_lev.c */
coordxy xstart, xsize;