summaryrefslogtreecommitdiff
path: root/doc/lispref/processes.texi
diff options
context:
space:
mode:
authorRichard Hansen <rhansen@rhansen.org>2022-06-16 15:21:57 -0400
committerEli Zaretskii <eliz@gnu.org>2022-06-22 16:55:40 +0300
commit55c2102560751ae05c98fd04120abcf4595d2a57 (patch)
treefefaefc7181a31eb469e2e14ed9d12d80ad45764 /doc/lispref/processes.texi
parenteff42dc0af741cc56c52d7d9577d29fc16f9f665 (diff)
downloademacs-55c2102560751ae05c98fd04120abcf4595d2a57.tar.gz
bindat (strz): Null terminate fixed-length strings if there is room
* lisp/emacs-lisp/bindat.el (bindat--pack-strz): For fixed-length strz fields, explicitly write a null terminator after the packed string if there is room (bug#56048). * doc/lispref/processes.texi (Bindat Types): Update documentation. * test/lisp/emacs-lisp/bindat-tests.el (bindat-test--str-strz-prealloc): Update tests.
Diffstat (limited to 'doc/lispref/processes.texi')
-rw-r--r--doc/lispref/processes.texi27
1 files changed, 14 insertions, 13 deletions
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index b9200aedde5..9e0bd98a54f 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -3509,23 +3509,24 @@ packed; other multibyte strings signal an error. When unpacking a
(but excluding) the null byte that terminated the input string.
If @var{len} is provided, @code{strz} behaves the same as @code{str},
-but with one difference: when unpacking, the first null byte
-encountered in the packed string is interpreted as the terminating
-byte, and it and all subsequent bytes are excluded from the result of
-the unpacking.
+but with a couple of differences:
-@quotation Caution
-The packed output will not be null-terminated unless one of the
-following is true:
-@itemize
+@itemize @bullet
@item
-The input string is shorter than @var{len} bytes and either no pre-allocated
-string was provided to @code{bindat-pack} or the appropriate byte in
-the pre-allocated string was already null.
+When packing, a null terminator is written after the packed input
+string if the number of characters in the input string is less than
+@var{len}.
+
@item
-The input string contains a null byte within the first @var{len}
-bytes.
+When unpacking, the first null byte encountered in the packed string
+is interpreted as the terminating byte, and it and all subsequent
+bytes are excluded from the result of the unpacking.
@end itemize
+
+@quotation Caution
+The packed output will not be null-terminated unless the input string
+is shorter than @var{len} bytes or it contains a null byte within the
+first @var{len} bytes.
@end quotation
@item vec @var{len} [@var{type}]