[PATCH 2/8] hex-escape: be more strict about the format while decoding

David Bremner david at tethera.net
Thu Apr 5 04:33:23 PDT 2012


Jani Nikula <jani at nikula.org> writes:

> Signed-off-by: Jani Nikula <jani at nikula.org>
>
> ---
>
> This could be folded to "hex-escape: (en|de)code strings to/from
> restricted character set".

That's probably a good plan.

> -	    if (len < 3)
> +	    if (!isxdigit ((unsigned char) p[1]) ||
> +		!isxdigit ((unsigned char) p[2]))

What happens if there are not two characters after the escape? Is this
relying on calling isxdigit on the null terminator?

d


More information about the notmuch mailing list