checkTypeSanity(((symbol *)sym)->etype, ((symbol *)sym)->name);
}
+ /* prevent overflow of the (r)name buffers */
+ if (strlen(sname)>SDCC_SYMNAME_MAX) {
+ werror (W_SYMBOL_NAME_TOO_LONG, SDCC_SYMNAME_MAX);
+ sname[SDCC_SYMNAME_MAX]='\0';
+ }
+
/* the symbols are always added at the head of the list */
i = hashKey (sname);
/* get a free entry */
#define SDCCSYMT_H
#define MAX_NEST_LEVEL 256
-#define SDCC_NAME_MAX 64
+#define SDCC_SYMNAME_MAX 64
+#define SDCC_NAME_MAX 3*SDCC_SYMNAME_MAX // big enough for _<func>_<var>_etc
#include "SDCChasht.h"
typedef struct symbol
{
- char name[SDCC_NAME_MAX + 1]; /* Input Variable Name */
+ char name[SDCC_SYMNAME_MAX + 1]; /* Input Variable Name */
char rname[SDCC_NAME_MAX + 1]; /* internal name */
short level; /* declration lev,fld offset */
"converting integral to pointer without a cast" },
{ W_PTR2INTEGRAL_NOCAST, ERROR_LEVEL_WARNING,
"converting pointer to integral without a cast" },
+{ W_SYMBOL_NAME_TOO_LONG, ERROR_LEVEL_WARNING,
+ "symbol name too long, truncated to %d chars" },
};
/*
#define E_VOID_VALUE_USED 153
#define W_INTEGRAL2PTR_NOCAST 154
#define W_PTR2INTEGRAL_NOCAST 155
+#define W_SYMBOL_NAME_TOO_LONG 156
/** Describes the maximum error level that will be logged. Any level
* includes all of the levels listed after it.