From 4ca1ba9c044d87219d04586ec4491cd3a92468c5 Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Sat, 18 Mar 2023 16:33:55 -0700 Subject: [PATCH] Free prefix buffer before execmod --- src/vmsrc/apple/soscmd.pla | 21 ++++++++++++--------- src/vmsrc/apple/soscmdjit.pla | 21 ++++++++++++--------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/vmsrc/apple/soscmd.pla b/src/vmsrc/apple/soscmd.pla index 54d385f..7b8526a 100755 --- a/src/vmsrc/apple/soscmd.pla +++ b/src/vmsrc/apple/soscmd.pla @@ -170,9 +170,11 @@ end // def shell#1 byte textmode[3] - byte prefix[64] + word prefix byte err[] word cmdptr + + prefix = heapalloc(64) // // Copy AUTORUN commmand line // @@ -188,18 +190,18 @@ def shell#1 break is 'P' if ^cmdptr and ^(cmdptr + 1) <> '/' - strcat(@prefix, cmdptr) + strcat(prefix, cmdptr) else - strcpy(@prefix, cmdptr) + strcpy(prefix, cmdptr) fin - setpfx(@prefix) + setpfx(prefix) break is '/' repeat - prefix-- - until prefix[prefix] == '/' - if prefix > 1 - setpfx(@prefix) + ^prefix-- + until prefix->[^prefix] == '/' + if ^prefix > 1 + setpfx(prefix) fin break is 'S' @@ -210,6 +212,7 @@ def shell#1 volumes break is '+' + heaprelease(prefix) //cmdsys:modexec(striptrail(cmdptr)) return striptrail(cmdptr) //cmdsys:syswrite(cmdsys.refcons, @textmode, 3) @@ -226,7 +229,7 @@ def shell#1 fin putln fin - puts(getpfx(@prefix)) + puts(getpfx(prefix)) cmdptr = gets($BA) strcpy(cmdsys:cmdline, cmdptr) until 0 diff --git a/src/vmsrc/apple/soscmdjit.pla b/src/vmsrc/apple/soscmdjit.pla index 917a809..2afec51 100755 --- a/src/vmsrc/apple/soscmdjit.pla +++ b/src/vmsrc/apple/soscmdjit.pla @@ -245,9 +245,11 @@ end // def shell#1 byte textmode[3] - byte prefix[64] + word prefix byte err[] word cmdptr + + prefix = heapalloc(64) // // Copy AUTORUN commmand line // @@ -263,18 +265,18 @@ def shell#1 break is 'P' if ^cmdptr and ^(cmdptr + 1) <> '/' - strcat(@prefix, cmdptr) + strcat(prefix, cmdptr) else - strcpy(@prefix, cmdptr) + strcpy(prefix, cmdptr) fin - setpfx(@prefix) + setpfx(prefix) break is '/' repeat - prefix-- - until prefix[prefix] == '/' - if prefix > 1 - setpfx(@prefix) + ^prefix-- + until prefix->[^prefix] == '/' + if ^prefix > 1 + setpfx(prefix) fin break is 'S' @@ -285,6 +287,7 @@ def shell#1 volumes break is '+' + heaprelease(prefix) *jitcodeptr = jitcbuf //cmdsys:modexec(striptrail(cmdptr)) return striptrail(cmdptr) @@ -302,7 +305,7 @@ def shell#1 fin putln fin - puts(getpfx(@prefix)) + puts(getpfx(prefix)) cmdptr = gets($BA) strcpy(cmdsys:cmdline, cmdptr) until 0