My video card issues some really weird messages to the message buffer, e.g. < 2>> When the message buffer has such problems, dmesg will seg fault. How-To-Repeat: I'm not sure how anyone else could mimic this problem.
Actually my suggested fix isn't going to work in every situation. How about: --- dmesg.c-orig Sat Feb 25 16:26:18 2006 +++ dmesg.c Sat Feb 25 16:52:11 2006 @@ -184,7 +184,8 @@ errno == 0) { if (LOG_FAC(pri) != LOG_KERN && !all) continue; - p = q + 1; + if (q < nextp) + p = q + 1; } } (This patch is unlikely to apply cleanly because my mail client has probably messed it up.)
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>
Hi Stephen, I would favour a fix of: if (p* == '<' && isdigit(*(p+1))) { Does this look OK to you? David.
David Malone wrote: > Hi Stephen, > > I would favour a fix of: > > if (p* == '<' && isdigit(*(p+1))) { > > Does this look OK to you? > > David. It looks great to me. -- Stephen Montgomery-Smith stephen@math.missouri.edu http://www.math.missouri.edu/~stephen
Responsible Changed From-To: freebsd-bugs->dwmalone I've committed something to -current which should fix the problem. I'll MFC in a couple of weeks if there are no objections.
State Changed From-To: open->closed Now fixed in -current, RELENG_6 and RELENG_5. Thanks for the patch, David.