data-out: Make binary output buffer big enough for a null terminator.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 18 Mar 2023 19:34:39 +0000 (12:34 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 18 Mar 2023 19:34:39 +0000 (12:34 -0700)
The max width for binary output is 16, for P or PK format, plus there
needs to be room for a null terminator, for a total width of 17 bytes.
The buffer here was undersized at only 16 bytes.  This commit fixes the
problem.

Thanks to Youngseok Choi for reporting the bug.

src/data/data-out.c

index 0815a5f7c5d3345f9d9cfefbe591f24ca4bb7737..563c63566acee081d3752786ea6850a9bb2bb1b4 100644 (file)
@@ -178,7 +178,7 @@ data_out_pool (const union value *input, const char *input_encoding,
     }
   else if (fmt_get_category (format.type) == FMT_CAT_BINARY)
     {
-      char tmp[16];
+      char tmp[17];
 
       assert (format.w + 1 <= sizeof tmp);
       converters[format.type] (input, format, settings, tmp);