NetBSD-Bugs archive

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

Re: bin/31908



The following reply was made to PR bin/31908; it has been noted by GNATS.

From: Christopher Berardi <cberardi%natoufa.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/31908
Date: Sat, 20 Feb 2010 17:32:31 -0500

 This bug seems to be caused by the return result from strtod(3), which man 
indicates should return HUGE_VAL in cases of overflow. So this patch should 
resolve the issue.
 
 
 
 --- top.c.orig 2010-02-20 17:15:33.000000000 -0500
 +++ top.c      2010-02-20 17:16:28.000000000 -0500
 @@ -43,6 +43,7 @@
  #include <signal.h>
  #include <setjmp.h>
  #include <ctype.h>
 +#include <math.h>
  #include <sys/types.h>
  #include <sys/uio.h>
  #include <unistd.h>
 @@ -395,7 +396,7 @@
  
        case 's':
            f = atof(optarg);
 -          if (f < 0 || (f == 0 && getuid() != 0))
 +          if (f < 0 || (f == 0 && getuid() != 0) || (f == HUGE_VAL))
            {
                message_error(" Bad seconds delay");
            }
 
 
 
 -- 
 Christopher Berardi
 http://www.natoufa.com/
 
 Be still, and know that I am God (Psalms 46:10)
 


Home | Main Index | Thread Index | Old Index