Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/sysctl detect integer overflow differently. previous ch...



details:   https://anonhg.NetBSD.org/src/rev/b0b66c683f38
branches:  trunk
changeset: 588118:b0b66c683f38
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Feb 08 18:13:56 2006 +0000

description:
detect integer overflow differently. previous change broke negative sysctl
values.

diffstat:

 sbin/sysctl/sysctl.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r c623969e3534 -r b0b66c683f38 sbin/sysctl/sysctl.c
--- a/sbin/sysctl/sysctl.c      Wed Feb 08 17:56:55 2006 +0000
+++ b/sbin/sysctl/sysctl.c      Wed Feb 08 18:13:56 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysctl.c,v 1.110 2006/02/05 22:42:55 christos Exp $ */
+/*     $NetBSD: sysctl.c,v 1.111 2006/02/08 18:13:56 christos Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
 #if 0
 static char sccsid[] = "@(#)sysctl.c   8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: sysctl.c,v 1.110 2006/02/05 22:42:55 christos Exp $");
+__RCSID("$NetBSD: sysctl.c,v 1.111 2006/02/08 18:13:56 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1670,8 +1670,8 @@
        switch (SYSCTL_TYPE(node->sysctl_flags)) {
        case CTLTYPE_INT:
                ii = (u_int)qi;
-               qo = ii;
-               if (qo != qi) {
+               io = (u_int)(qi >> 32);
+               if (io != (u_int)-1 && io != 0) {
                        sysctlperror("%s: %s\n", value, strerror(ERANGE));
                        EXIT(1);
                }



Home | Main Index | Thread Index | Old Index