[Tarantool-patches] [PATCH v7] base64: fix decoder output buffer overrun (reads)

Alexander Turenko alexander.turenko at tarantool.org
Wed Mar 3 02:08:20 MSK 2021


> -static int
> -base64_decode_block(const char *in_base64, int in_len,
> -		    char *out_bin, int out_len,
> -		    struct base64_decodestate *state)
> +int
> +base64_decode(const char *in_base64, int in_len,
> +	      char *out_bin, int out_len)
>  {
>  	const char *in_pos = in_base64;
>  	const char *in_end = in_base64 + in_len;
>  	char *out_pos = out_bin;
>  	char *out_end = out_bin + out_len;
>  	int fragment;
> +	char curr_byte;

AFAIR, nothing prevent us from using `*out_pos`. I don't see a reason to
introduce `curr_byte`. It was necessary in v6 to store the initial
state for a block.


More information about the Tarantool-patches mailing list