Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Feb 2006 18:00:25 GMT
From:      Stephen Montgomery-Smith <stephen@math.missouri.edu>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/93841: seg fault with dmesg
Message-ID:  <200602261800.k1QI0P48085896@freefall.freebsd.org>

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

From: Stephen Montgomery-Smith <stephen@math.missouri.edu>
To: bug-followup@FreeBSD.org,  stephen@math.missouri.edu
Cc:  
Subject: Re: bin/93841: seg fault with dmesg
Date: Sun, 26 Feb 2006 11:59:32 -0600

 And this is a slightly cleaner way to fix the problem.
 
 --- dmesg.c-orig	Sat Feb 25 16:26:18 2006
 +++ dmesg.c	Sat Feb 25 17:06:55 2006
 @@ -180,8 +180,8 @@
   		if (*p == '<') {
   			errno = 0;
   			pri = strtol(p + 1, &q, 10);
 -			if (*q == '>' && pri >= 0 && pri < INT_MAX &&
 -			    errno == 0) {
 +			if (q < nextp && *q == '>' && pri >= 0 &&
 +			    pri < INT_MAX && errno == 0) {
   				if (LOG_FAC(pri) != LOG_KERN && !all)
   					continue;
   				p = q + 1;
 
 Another possibility is to change the first if statement above to 
 something like
 
 if (p* == '<' && !isspace(*(p+1))) {
 
 but that might or might not have an undesired effect, because I don't 
 know if you mean to delete stuff like
 < 2>



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