kern/80775: sysctl_handle_string should have a timeout

Volker volker at vwsoft.com
Wed Mar 12 03:20:02 UTC 2008


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

From: Volker <volker at vwsoft.com>
To: bug-followup at FreeBSD.org, hselasky at c2i.net
Cc:  
Subject: Re: kern/80775: sysctl_handle_string should have a timeout
Date: Wed, 12 Mar 2008 04:10:43 +0100

 This is a multi-part message in MIME format.
 --------------010200040307020300060705
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 Sounds reasonable. Following is an exact patch (for the completeness of
 this ticket).
 
 --------------010200040307020300060705
 Content-Type: text/x-patch;
  name="kern_sysctl.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="kern_sysctl.diff"
 
 --- sys/kern/kern_sysctl.c.orig	2008-03-12 04:03:09.000000000 +0100
 +++ sys/kern/kern_sysctl.c	2008-03-12 04:05:43.000000000 +0100
 @@ -929,6 +929,7 @@
  	int error=0;
  	char *tmparg;
  	size_t outlen;
 +	u_int8_t to = 255;
  
  	/*
  	 * Attempt to get a coherent snapshot by copying to a
 @@ -940,7 +941,10 @@
  
  	if (strlcpy(tmparg, (char *)arg1, outlen) >= outlen) {
  		free(tmparg, M_SYSCTLTMP);
 -		goto retry;
 +		if( to-- )
 +			goto retry;
 +		else
 +			return (EINVAL);
  	}
  
  	error = SYSCTL_OUT(req, tmparg, outlen);
 
 --------------010200040307020300060705--


More information about the freebsd-bugs mailing list