From 99bb2501e37b8caf639abecd2e7d9924bc84f2f5 Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Mon, 23 Jun 2025 12:22:20 +0000 Subject: [PATCH] (zilch magic): fix off-by-one when replacing the end of the string --- core/src/magic.sld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/magic.sld b/core/src/magic.sld index 54b103b..5a98e3f 100644 --- a/core/src/magic.sld +++ b/core/src/magic.sld @@ -282,7 +282,7 @@ (define parts '()) (let find-part-at ((i 0) (last-i 0)) (let ((next-slash (bytestring-index str (lambda (c) (= c #x2F)) i))) - (if (or (not next-slash) (>= next-slash (- (bytevector-length str) 53))) + (if (or (not next-slash) (> next-slash (- (bytevector-length str) 53))) (if (= last-i 0) (set! parts #f) (set! parts (cons (bytevector-copy str last-i) parts)))