From: Taylor R Campbell Date: Wed, 9 Jan 2019 03:46:26 +0000 (+0000) Subject: NUL-terminate bytevectors too. X-Git-Tag: mit-scheme-pucked-10.1.10~6^2~63 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=0bbb88bff7c9e0aca150303c4e1219ec5c138fe3;p=mit-scheme.git 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. --- 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); }