

Fix a read head-buffer-overflow in esm
source link: https://gitlab.com/OpenMW/openmw/-/merge_requests/751
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Fix a read head-buffer-overflow in esm
The check forgot to account for the terminal zero.
This is probably ok, but I'm wondering if the overflow condition can't be made more clear/more high-level. Casting a pointer to a size_t is bad because the size of the pointer type is not necessarily the same as the size of size_t (though it doesn't matter in this case as there's no way the script variables table will be long enough to break the assumption). Never mind, I forgot it's not a pointer type that is the result of pointer substraction. Still...
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK