aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;