summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
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 /test/lisp/emacs-lisp
parenteff42dc0af741cc56c52d7d9577d29fc16f9f665 (diff)
downloademacs-55c2102560751ae05c98fd04120abcf4595d2a57.tar.gz
emacs-55c2102560751ae05c98fd04120abcf4595d2a57.tar.bz2
emacs-55c2102560751ae05c98fd04120abcf4595d2a57.zip
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 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/bindat-tests.el12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/lisp/emacs-lisp/bindat-tests.el b/test/lisp/emacs-lisp/bindat-tests.el
index cc223ad14e2..0c03c51e2ef 100644
--- a/test/lisp/emacs-lisp/bindat-tests.el
+++ b/test/lisp/emacs-lisp/bindat-tests.el
@@ -172,14 +172,14 @@
((((x str 2)) ((x . "a"))) . "ax")
((((x str 2)) ((x . "ab"))) . "ab")
((((x str 2)) ((x . "abc"))) . "ab")
- ((,(bindat-type strz 1) "") . "xx")
- ((,(bindat-type strz 2) "") . "xx")
- ((,(bindat-type strz 2) "a") . "ax")
+ ((,(bindat-type strz 1) "") . "\0x")
+ ((,(bindat-type strz 2) "") . "\0x")
+ ((,(bindat-type strz 2) "a") . "a\0")
((,(bindat-type strz 2) "ab") . "ab")
((,(bindat-type strz 2) "abc") . "ab")
- ((((x strz 1)) ((x . ""))) . "xx")
- ((((x strz 2)) ((x . ""))) . "xx")
- ((((x strz 2)) ((x . "a"))) . "ax")
+ ((((x strz 1)) ((x . ""))) . "\0x")
+ ((((x strz 2)) ((x . ""))) . "\0x")
+ ((((x strz 2)) ((x . "a"))) . "a\0")
((((x strz 2)) ((x . "ab"))) . "ab")
((((x strz 2)) ((x . "abc"))) . "ab")
((,(bindat-type strz) "") . "\0x")