From 0d1c459c3292616bd6260c08f91b59f4a987a879 Mon Sep 17 00:00:00 2001 From: Lassi Kortela Date: Sun, 23 Jun 2019 12:10:18 +0300 Subject: [PATCH] Pad strings with null bytes Not really needed (since the header buffer starts with all null bytes) but these are the correct semantics. --- trivial-tar-writer.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trivial-tar-writer.scm b/trivial-tar-writer.scm index 2146ace..004a4ac 100644 --- a/trivial-tar-writer.scm +++ b/trivial-tar-writer.scm @@ -8,7 +8,8 @@ (let* ((bytes (string->utf8 string)) (nnull (- nbyte (bytevector-length bytes)))) (when (< nnull 0) (error "tar: string too long")) - (bytevector-copy! header at bytes))) + (bytevector-copy! header at bytes) + (bytevector-copy! header (+ at (bytevector-length bytes)) nulls 0 nnull))) (define (tar-poke-octal! header at nbyte number) (unless (integer? number) (error "tar: not an integer"))