Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/elf2aout Try to fix build on 32bit architectures.



details:   https://anonhg.NetBSD.org/src/rev/27b3015aadd9
branches:  trunk
changeset: 343961:27b3015aadd9
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Mar 07 08:59:00 2016 +0000

description:
Try to fix build on 32bit architectures.

diffstat:

 usr.bin/elf2aout/elf2aout.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r b6cf01878443 -r 27b3015aadd9 usr.bin/elf2aout/elf2aout.c
--- a/usr.bin/elf2aout/elf2aout.c       Mon Mar 07 01:41:55 2016 +0000
+++ b/usr.bin/elf2aout/elf2aout.c       Mon Mar 07 08:59:00 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elf2aout.c,v 1.17 2016/03/06 16:13:21 christos Exp $   */
+/*     $NetBSD: elf2aout.c,v 1.18 2016/03/07 08:59:00 martin Exp $     */
 
 /*
  * Copyright (c) 1995
@@ -370,7 +370,7 @@
        memset(outbuf, 0, sizeof outbuf);
 
        /* Find number of symbols to process... */
-       remaining = symsize / (ssize_t)sizeof(Elf32_Sym);
+       remaining = symsize / (off_t)sizeof(Elf32_Sym);
 
        /* Suck in the old string table... */
        oldstrings = saveRead(in, stroff, (size_t)strsize, "string table");
@@ -478,7 +478,9 @@
        /* Go to the start of the ELF symbol table... */
        if (lseek(in, offset, SEEK_SET) < 0)
                err(EXIT_FAILURE, "%s: lseek failed", __func__);
-       remaining = size;
+       if (size > SSIZE_MAX)
+               err(EXIT_FAILURE, "%s: can not copy this much", __func__);
+       remaining = (ssize_t)size;
        while (remaining) {
                cur = remaining;
                if (cur > (int)sizeof ibuf)



Home | Main Index | Thread Index | Old Index