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

@@ -882,9 +882,8 @@ const struct instance_globals_w g_init_w = {
UNDEFINED_PTR, /* wportal */
/* new */
{ wdmode_traditional, NO_COLOR }, /* wsettings */
TRUE, /* havestate*/
IVMAGIC /* w_magic used to validate that structure layout has been preserved */
IVMAGIC /* w_magic to validate that structure layout has been preserved */
};
const struct instance_globals_x g_init_x = {
@@ -895,6 +894,8 @@ const struct instance_globals_x g_init_x = {
/* mkmaze.c */
UNDEFINED_VALUE, /* xmin */
UNDEFINED_VALUE, /* xmax */
/* objnam.c */
NULL, /* xnamep */
/* sp_lev.c */
UNDEFINED_VALUE, /* xstart */
UNDEFINED_VALUE, /* xsize */