summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf/map_object.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2003-05-04 00:56:00 +0000
committerobrien <obrien@FreeBSD.org>2003-05-04 00:56:00 +0000
commit43ecc39077d55a2ece31e75c8e80612a8b840785 (patch)
tree5b9b023080432ede3e9df64830aa17a49633aaba /libexec/rtld-elf/map_object.c
parentbef29d279be2b25e16fa173fb9f5f5117075524e (diff)
downloadFreeBSD-src-43ecc39077d55a2ece31e75c8e80612a8b840785.zip
FreeBSD-src-43ecc39077d55a2ece31e75c8e80612a8b840785.tar.gz
Fix signed/unsigned comparison warnings.
Diffstat (limited to 'libexec/rtld-elf/map_object.c')
-rw-r--r--libexec/rtld-elf/map_object.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c
index 8e74e37..b7bbb1e 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;
}
OpenPOWER on IntegriCloud