aboutsummaryrefslogtreecommitdiff
path: root/session.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-12-18 01:57:46 +0700
committerShulhan <ms@kilabit.info>2023-12-18 01:57:46 +0700
commit207cc263d4f28e11af896f0b1e3fc06d305c2a62 (patch)
tree9afb9e9a1f179227b45fc74cd40edbd98b3c9848 /session.go
parent1640caca8245096a7fb1bc6f1b1e03881ce5824e (diff)
downloadawwan-207cc263d4f28e11af896f0b1e3fc06d305c2a62.tar.xz
all: fix panic due to out of range when running "#require" statement
Diffstat (limited to 'session.go')
-rw-r--r--session.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/session.go b/session.go
index c156710..dc07e15 100644
--- a/session.go
+++ b/session.go
@@ -414,6 +414,10 @@ func (ses *Session) close() (err error) {
// executeRequires run the "#require:" statements from line 0 until
// the start argument in the local system.
func (ses *Session) executeRequires(req *ExecRequest, pos linePosition) (err error) {
+ if pos.start >= int64(len(req.script.requires)) {
+ return nil
+ }
+
var (
stmt *Statement
x int64