Skip to content

Commit f4f6caa

Browse files
committed
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
1 parent 050beac commit f4f6caa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/utils/adt/network.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* PostgreSQL type definitions for the INET and CIDR types.
33
*
4-
* $PostgreSQL: pgsql/src/backend/utils/adt/network.c,v 1.53 2004/08/29 05:06:49 momjian Exp $
4+
* $PostgreSQL: pgsql/src/backend/utils/adt/network.c,v 1.54 2004/10/08 01:10:31 momjian Exp $
55
*
66
* Jon Postel RIP 16 Oct 1998
77
*/
@@ -942,7 +942,7 @@ addressOK(unsigned char *a, int bits, int family)
942942
if (bits == maxbits)
943943
return true;
944944

945-
byte = (bits + 7) / 8;
945+
byte = bits / 8;
946946
nbits = bits % 8;
947947
mask = 0xff;
948948
if (bits != 0)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy