Pad strings with null bytes

Not really needed (since the header buffer starts with all null bytes)
but these are the correct semantics.
This commit is contained in:
Lassi Kortela 2019-06-23 12:10:18 +03:00
parent 1b202c2021
commit 0ac8f79e50
1 changed files with 2 additions and 1 deletions

View File

@ -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"))