From owner-cvs-all Sat May 19 12:36:37 2001 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 01F1837B422; Sat, 19 May 2001 12:36:33 -0700 (PDT) (envelope-from jdp@FreeBSD.org) Received: (from jdp@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4JJaW831616; Sat, 19 May 2001 12:36:32 -0700 (PDT) (envelope-from jdp) Message-Id: <200105191936.f4JJaW831616@freefall.freebsd.org> From: John Polstra Date: Sat, 19 May 2001 12:36:32 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/netgraph ng_parse.c X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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