|
From: | Stefan Monnier |
Subject: | bug#55938: [PATCH] bindat (strz): Error on null byte if packing variable-length string |
Date: | Mon, 13 Jun 2022 09:12:20 -0400 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
> (let* ((v (string-to-unibyte v)) > (len (length v))) > (dotimes (i len) > + (if (= (aref v i) 0) > + ;; Alternatively we could pretend that this was the end of > + ;; the string and stop packing, but then bindat-length would > + ;; need to scan the input string looking for a null byte. > + (error "Null byte encountered in input strz string")) I suspect a `string-match` looking for NUL would be faster. Stefan
[Prev in Thread] | Current Thread | [Next in Thread] |