diff options
| author | David E. O'Brien <obrien@FreeBSD.org> | 2003-05-04 00:56:00 +0000 |
|---|---|---|
| committer | David E. O'Brien <obrien@FreeBSD.org> | 2003-05-04 00:56:00 +0000 |
| commit | 78af18bd240456a39d887f53917920abe63237d6 (patch) | |
| tree | 5b9b023080432ede3e9df64830aa17a49633aaba /libexec/rtld-elf/map_object.c | |
| parent | 8f5f415d441cf8f717a86d38e380b23471ed86a8 (diff) | |
Notes
Diffstat (limited to 'libexec/rtld-elf/map_object.c')
| -rw-r--r-- | libexec/rtld-elf/map_object.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c index 8e74e37cb327..b7bbb1ec995b 100644 --- a/libexec/rtld-elf/map_object.c +++ b/libexec/rtld-elf/map_object.c @@ -57,7 +57,8 @@ map_object(int fd, const char *path, const struct stat *sb) Elf_Ehdr hdr; char buf[PAGE_SIZE]; } u; - int nbytes, i; + int i; + ssize_t nbytes; Elf_Phdr *phdr; Elf_Phdr *phlimit; Elf_Phdr **segs; @@ -91,7 +92,7 @@ map_object(int fd, const char *path, const struct stat *sb) } /* Make sure the file is valid */ - if (nbytes < sizeof(Elf_Ehdr) + if (nbytes < (ssize_t)sizeof(Elf_Ehdr) || u.hdr.e_ident[EI_MAG0] != ELFMAG0 || u.hdr.e_ident[EI_MAG1] != ELFMAG1 || u.hdr.e_ident[EI_MAG2] != ELFMAG2 @@ -128,7 +129,7 @@ map_object(int fd, const char *path, const struct stat *sb) "%s: invalid shared object: e_phentsize != sizeof(Elf_Phdr)", path); return NULL; } - if (u.hdr.e_phoff + u.hdr.e_phnum*sizeof(Elf_Phdr) > nbytes) { + if (u.hdr.e_phoff + u.hdr.e_phnum * sizeof(Elf_Phdr) > (size_t)nbytes) { _rtld_error("%s: program header too large", path); return NULL; } |
