The nlist() function is limited to handle ELF binaries of the same class
as size as the size_t of the architecture built.
In addition the SIZE_T_MAX macro is BSD specific, and was falling back
to the wrong constant on most 64-bit non-BSD systems.
Warned-by: gcc
#include "local-elf.h"
-#ifndef SIZE_T_MAX
-#define SIZE_T_MAX 0xffffffffU
-#endif
-
/* Note: This function is used by libkvm0, so we need to export it.
* It is not declared in the include files though. */
int __fdnlist(int, struct nlist *);
shdr_size = ehdr.e_shentsize * ehdr.e_shnum;
/* Make sure it's not too big to mmap */
- if (shdr_size > SIZE_T_MAX || shdr_size > st.st_size) {
+ if (shdr_size > st.st_size) {
errno = EFBIG;
return (-1);
}
}
/* Check for files too large to mmap. */
- if (symstrsize > SIZE_T_MAX || symstrsize > st.st_size) {
+ if (symstrsize > st.st_size) {
errno = EFBIG;
goto done;
}