A variation on the sign-compare fix for these.

This commit is contained in:
lukem 2009-02-16 10:40:45 +00:00
parent ae34e73bcb
commit be48221f4f
4 changed files with 12 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nlist_aout.c,v 1.17 2009/02/16 10:34:15 tron Exp $ */
/* $NetBSD: nlist_aout.c,v 1.18 2009/02/16 10:40:45 lukem Exp $ */
/*
* Copyright (c) 1989, 1993
@ -66,7 +66,7 @@
#if 0
static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: nlist_aout.c,v 1.17 2009/02/16 10:34:15 tron Exp $");
__RCSID("$NetBSD: nlist_aout.c,v 1.18 2009/02/16 10:40:45 lukem Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -114,7 +114,7 @@ __fdnlist_aout(fd, list)
stroff = symoff + symsize;
/* Check for files too large to mmap. */
if (st.st_size - stroff > (off_t)SIZE_T_MAX) {
if ((uintmax_t)(st.st_size - stroff) > (uintmax_t)SIZE_T_MAX) {
errno = EFBIG;
return (-1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nlist_coff.c,v 1.6 2006/10/25 20:43:49 uwe Exp $ */
/* $NetBSD: nlist_coff.c,v 1.7 2009/02/16 10:40:45 lukem Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nlist_coff.c,v 1.6 2006/10/25 20:43:49 uwe Exp $");
__RCSID("$NetBSD: nlist_coff.c,v 1.7 2009/02/16 10:40:45 lukem Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -108,7 +108,7 @@ __fdnlist_coff(fd, list)
/*
* Map the file in its entirety.
*/
if (st.st_size > SIZE_T_MAX) {
if ((uintmax_t)st.st_size > (uintmax_t)SIZE_T_MAX) {
errno = EFBIG;
BAD;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nlist_ecoff.c,v 1.16 2009/02/16 05:22:00 lukem Exp $ */
/* $NetBSD: nlist_ecoff.c,v 1.17 2009/02/16 10:40:45 lukem Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nlist_ecoff.c,v 1.16 2009/02/16 05:22:00 lukem Exp $");
__RCSID("$NetBSD: nlist_ecoff.c,v 1.17 2009/02/16 10:40:45 lukem Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -93,7 +93,7 @@ __fdnlist_ecoff(fd, list)
/*
* Map the file in its entirety.
*/
if ((size_t)st.st_size > SIZE_T_MAX) {
if ((uintmax_t)st.st_size > (uintmax_t)SIZE_T_MAX) {
errno = EFBIG;
BAD;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: nlist_elf32.c,v 1.29 2009/02/06 23:47:44 lukem Exp $ */
/* $NetBSD: nlist_elf32.c,v 1.30 2009/02/16 10:40:45 lukem Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou
@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: nlist_elf32.c,v 1.29 2009/02/06 23:47:44 lukem Exp $");
__RCSID("$NetBSD: nlist_elf32.c,v 1.30 2009/02/16 10:40:45 lukem Exp $");
#endif /* LIBC_SCCS and not lint */
/* If not included by nlist_elf64.c, ELFSIZE won't be defined. */
@ -110,7 +110,7 @@ ELFNAMEEND(__fdnlist)(fd, list)
/*
* Map the file in its entirety.
*/
if ((size_t)st.st_size > SIZE_T_MAX) {
if ((uintmax_t)st.st_size > (uintmax_t)SIZE_T_MAX) {
errno = EFBIG;
BAD;
}