Avoid generating pointers in writeable data section.

They increase memory consumption and make exploits
easier and are completely unnecessary.
Avoid them by either avoiding the pointer indirection
completely by using char arrays for strings instead
of char pointers, convert "static" pointer variables
to simple local variables, or mark the array of
pointers as const instead of just the things pointed to.
This commit is contained in:
Reimar Döffinger
2019-11-05 22:13:15 +01:00
committed by Reimar Döffinger
parent a550507517
commit 3168641320
4 changed files with 10 additions and 10 deletions

View File

@@ -208,8 +208,8 @@ int get_default_class_id(const charT* p1, const charT* p2)
{data+63, data+67,}, // word
{data+67, data+73,}, // xdigit
};
static const character_pointer_range<charT>* ranges_begin = ranges;
static const character_pointer_range<charT>* ranges_end = ranges + (sizeof(ranges)/sizeof(ranges[0]));
const character_pointer_range<charT>* ranges_begin = ranges;
const character_pointer_range<charT>* ranges_end = ranges + (sizeof(ranges)/sizeof(ranges[0]));
character_pointer_range<charT> t = { p1, p2, };
const character_pointer_range<charT>* p = std::lower_bound(ranges_begin, ranges_end, t);