| From: | Aleksander Alekseev <aleksander(at)timescale(dot)com> |
|---|---|
| To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
| Cc: | Jacob Champion <jchampion(at)timescale(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
| Subject: | Re: [PoC] Let libpq reject unexpected authentication requests |
| Date: | 2022-11-12 06:57:06 |
| Message-ID: | CAJ7c6TNFuCeos0J-kVDGXjSOyrL=zMZrGyb7+8SFd+iKOFFmdg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Jacob,
> > Assigning a negative number to uint32 doesn't necessarily work on all
> > platforms. I suggest using PG_UINT32_MAX.
>
> Hmm -- on which platforms is "-1 converted to unsigned" not equivalent
> to the maximum value? Are they C-compliant?
I did a little more research and I think you are right. What happens
according to the C standard:
"""
the value is converted to unsigned by adding to it one greater than the largest
number that can be represented in the unsigned integer type
"""
so this is effectively -1 + (PG_UINT32_MAX + 1).
--
Best regards,
Aleksander Alekseev
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Julien Rouhaud | 2022-11-12 08:13:53 | Re: Allow file inclusion in pg_hba and pg_ident files |
| Previous Message | Amit Kapila | 2022-11-12 04:12:06 | Re: Typo about subxip in comments |