Date: Sat, 19 May 2001 12:36:32 -0700 (PDT) From: John Polstra <jdp@FreeBSD.org> To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/netgraph ng_parse.c Message-ID: <200105191936.f4JJaW831616@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
jdp 2001/05/19 12:36:32 PDT Modified files: sys/netgraph ng_parse.c Log: Fix a range checking bug in ng_int32_parse which affected 64-bit machines. The code formerly read: long val; if (val < (long)-0x80000000 || ...) return EINVAL; The constant 0x80000000 has type unsigned int. The unary `-' operator does not change the type (or the value, in this case). Therefore the promotion to long is done by 0-extension, giving 0x0000000080000000 instead of the desired 0xffffffff80000000. I got rid of the `-' and changed the cast to (int32_t) to give proper sign-extension on all architectures and to better reflect the fact that we are range-checking a 32-bit value. This commit also makes the analogous changes to ng_int{8,16}_parse for consistency. MFC after: 3 days Revision Changes Path 1.11 +6 -5 src/sys/netgraph/ng_parse.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105191936.f4JJaW831616>