Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Sep 1999 13:30:02 -0700 (PDT)
From:      adrian@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/1943: route(8) args
Message-ID:  <199909182030.NAA84051@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/1943; it has been noted by GNATS.

From: adrian@freebsd.org
To: freebsd-gnats-submit@freebsd.org
Cc: Adam David <adam@veda.is>
Subject: Re: bin/1943: route(8) args
Date: Sun, 19 Sep 1999 04:21:01 +0800

 It doesn't seem to segfault now - the checks are stringer,
 however the atoi() isn't too nice. Here's a patch to fix
 that.
 
 Apply it, see if it works, and get back to me as to whether
 we can close this PR or not.
 
 
 
 Adrian
 
 
 
 
 Index: route.c
 ===================================================================
 RCS file: /home/ncvs/src/sbin/route/route.c,v
 retrieving revision 1.32
 diff -u -r1.32 route.c
 --- route.c	1999/08/28 00:14:13	1.32
 +++ route.c	1999/09/18 20:22:18
 @@ -479,6 +479,7 @@
  {
  	int flag = 0;
  	u_long noval, *valp = &noval;
 +	char *endp;
  
  	switch (key) {
  #define caseof(x, y, z)	case x: valp = &rt_metrics.z; flag = y; break
 @@ -496,7 +497,10 @@
  		rt_metrics.rmx_locks |= flag;
  	if (locking)
  		locking = 0;
 -	*valp = atoi(value);
 +	/* check to make sure its a number */
 +	*valp = strtoul(value, &endp, 10);
 +	if (*endp != NULL)
 +		errx(EX_DATAERR, "Invalid non-numerical value '%s'", value);
  }
  
  void
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199909182030.NAA84051>