scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 8146aa7b30d3c4955c4066203b9dc1bf06d4225b
parent 2f447b6852197777c05333923299ae10def18c32
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 24 Nov 2017 20:51:32 +0100

[nm] Add explicit check in ftell()

Ftell() can return -1 if the current position cannot be represented
in a long.

Diffstat:
Mnm/main.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nm/main.c b/nm/main.c @@ -118,7 +118,7 @@ ar(char *fname, FILE *fp) while (rdarhdr(fp, &hdr) != EOF) { pos = ftell(fp); - if (pos > LONG_MAX - hdr.size) { + if (pos == -1 || pos > LONG_MAX - hdr.size) { fprintf(stderr, "nm: %s: overflow in size of archive\n", fname);