From 0bbb88bff7c9e0aca150303c4e1219ec5c138fe3 Mon Sep 17 00:00:00 2001
From: Taylor R Campbell <campbell@mumble.net>
Date: Wed, 9 Jan 2019 03:46:26 +0000
Subject: [PATCH] NUL-terminate bytevectors too.

This shouldn't be necessary but we use these for primitive names with
routines that expect them to be NUL-terminated, so this is more
convenient until we either length-delimit the primitive names or
explicitly NUL-terminate them or whatever.
---
 src/microcode/bytevector.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/microcode/bytevector.c b/src/microcode/bytevector.c
index 6ef990ba9..09dfd8b46 100644
--- a/src/microcode/bytevector.c
+++ b/src/microcode/bytevector.c
@@ -56,9 +56,10 @@ allocate_bytevector (unsigned long nbytes)
   SCHEME_OBJECT result
     = (allocate_non_marked_vector
        (TC_BYTEVECTOR,
-        ((BYTES_TO_WORDS (nbytes)) + BYTEVECTOR_LENGTH_SIZE),
+        ((BYTES_TO_WORDS (nbytes + 1)) + BYTEVECTOR_LENGTH_SIZE),
         true));
   SET_BYTEVECTOR_LENGTH (result, nbytes);
+  ((BYTEVECTOR_POINTER (result)) [nbytes]) = '\0';
   return (result);
 }
 
-- 
2.25.1