On 4/1/21 12:53 AM, Zhihong Yu wrote:
> Hi,
> For inet data type fix:
>
> + unsigned char a = addra[i];
> + unsigned char b = addrb[i];
> +
> + if (i >= lena)
> + a = 0;
> +
> + if (i >= lenb)
> + b = 0;
>
> Should the length check precede the addra[i] ?
> Something like:
>
> unsigned char a;
> if (i >= lena) a = 0;
> else a = addra[i];
>
I don't think that makes any difference. We know the bytes are there, we
just want to ignore / reset them in some cases.
regards
--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company