1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Do proper testing of CIDR bits against network mask, e.g. don't allow:

test=# select '204.248.199.1/31'::cidr;

Previous releases erroneously accepted such addresses.

WARN IN RELEASE NOTES

Kevin Brintnall
This commit is contained in:
Bruce Momjian
2004-10-08 01:10:31 +00:00
parent 050beacc6e
commit f4f6caa9b0

View File

@ -1,7 +1,7 @@
/*
* PostgreSQL type definitions for the INET and CIDR types.
*
* $PostgreSQL: pgsql/src/backend/utils/adt/network.c,v 1.53 2004/08/29 05:06:49 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/network.c,v 1.54 2004/10/08 01:10:31 momjian Exp $
*
* Jon Postel RIP 16 Oct 1998
*/
@ -942,7 +942,7 @@ addressOK(unsigned char *a, int bits, int family)
if (bits == maxbits)
return true;
byte = (bits + 7) / 8;
byte = bits / 8;
nbits = bits % 8;
mask = 0xff;
if (bits != 0)