X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=direct.c;h=809bb79090460d4632a7c397e5de0061819af491;hb=ca744716ef85b25c66ebd03d54035e06a89558fc;hp=d6d6c3f2e63499d7301253b41f9881eb72daef08;hpb=9ecc6f5e49e1740adee78dd45e1115c7e4fcc314;p=rmac diff --git a/direct.c b/direct.c index d6d6c3f..809bb79 100644 --- a/direct.c +++ b/direct.c @@ -1,7 +1,7 @@ // -// RMAC - Reboot's Macro Assembler for all Atari computers +// RMAC - Renamed Macro Assembler for all Atari computers // DIRECT.C - Directive Handling -// Copyright (C) 199x Landon Dyer, 2011-2020 Reboot and Friends +// Copyright (C) 199x Landon Dyer, 2011-2021 Reboot and Friends // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986 // Source utilised with the kind permission of Landon Dyer // @@ -622,6 +622,10 @@ allright: close(fd); return ERROR; } + if ((int64_t)size <= 0) + { + return error("invalid incbin size requested"); + } } else size = lseek(fd, 0L, SEEK_END); @@ -641,7 +645,10 @@ allright: } lseek(fd, pos, SEEK_SET); - size -= pos; + if ((int64_t)(size - pos) < 0) + { + return error("requested incbin size out of range"); + } } else {