bin/93841: seg fault with dmesg

Stephen Montgomery-Smith stephen at math.missouri.edu
Sun Feb 26 10:00:29 PST 2006


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

From: Stephen Montgomery-Smith <stephen at math.missouri.edu>
To: bug-followup at FreeBSD.org,  stephen at 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>


More information about the freebsd-bugs mailing list