From d01138366c3ecb7cd363e5138cabc38c6a01271e Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Tue, 17 Sep 2024 21:09:02 -0400 Subject: [PATCH] Escape dots in regex for using startupString in "code" Otherwise, we could theoretically load a file named something like "startupxm2xin", call "code" on something from that file, and end up with some code from startup.m2.in. --- M2/Macaulay2/m2/code.m2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/M2/Macaulay2/m2/code.m2 b/M2/Macaulay2/m2/code.m2 index edf6ddffc1..f6aecdffb9 100644 --- a/M2/Macaulay2/m2/code.m2 +++ b/M2/Macaulay2/m2/code.m2 @@ -57,7 +57,7 @@ code FilePosition := x -> ( ( wp := set characters " \t\r);"; file := ( - if match("startup.m2.in$", filename) then startupString + if match("startup\\.m2\\.in$", filename) then startupString else if filename === "currentString" then ( if currentString === null then error "code no longer available"