提交 c2c86e48 编写于 作者: H Heikki Linnakangas

Fix off-by-one bug in bitncmp(): When comparing a number of bits divisible by

8, bitncmp() may dereference a pointer one byte out of bounds.

Chris Mikkelson (bug #5101)
上级 895a3fb6
/*
* PostgreSQL type definitions for the INET and CIDR types.
*
* $PostgreSQL: pgsql/src/backend/utils/adt/network.c,v 1.72 2007/11/15 21:14:39 momjian Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/network.c,v 1.72.2.1 2009/10/08 04:46:37 heikki Exp $
*
* Jon Postel RIP 16 Oct 1998
*/
......@@ -994,7 +994,7 @@ bitncmp(void *l, void *r, int n)
b = n / 8;
x = memcmp(l, r, b);
if (x)
if (x || (n % 8) == 0)
return x;
lb = ((const u_char *) l)[b];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册