aboutsummaryrefslogtreecommitdiff
path: root/bas.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-07-15 14:36:57 -0400
committerB. Watson <urchlay@slackware.uk>2024-07-15 15:36:39 -0400
commit4b72993e746bc654178ba80b66ed6a1f854210e1 (patch)
tree501258dbab1e42f30601d93504bbf5816921f563 /bas.c
parentc8a7eb85d06c71a184a7fe5aabd732d0779900cf (diff)
downloadbw-atari8-tools-4b72993e746bc654178ba80b66ed6a1f854210e1.tar.gz
bas.c: warn and return from walk_code() if the program ends in the middle of a line.
Diffstat (limited to 'bas.c')
-rw-r--r--bas.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bas.c b/bas.c
index ddc424f..94ba310 100644
--- a/bas.c
+++ b/bas.c
@@ -316,6 +316,10 @@ void walk_code(unsigned int startlineno, unsigned int endlineno) {
lineno = tmpno;
offset = program[linepos + 2];
nextpos = linepos + offset;
+ if(nextpos > filelen) {
+ fprintf(stderr, "Warning: program truncated in the middle of line %d.\n", lineno);
+ return;
+ }
end = nextpos;
pos = linepos;