Subject: bug#55938: [PATCH] bindat (strz): Error on null byte if packing variable-length string

From: Stefan Monnier <[email-masked]>
Date: Mon, 13 Jun 2022 09:12:20 -0400

>    (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