kdump: use VIS_NOLOCALE when printing output

Attempting to parse the output as UTF-8 exposed an out-of-bounds read
in vis(3) (see https://reviews.freebsd.org/D30771). However, I don't
think it makes much sense to decode this output at all. Additionally,
passing one byte at a time will almost certainly result in incorrect
output for multi-byte characters.

Reviewed By:	brooks
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D30772
This commit is contained in:
Alex Richardson 2021-06-16 16:28:27 +01:00
parent 1a2f06d0f2
commit 1a3a57d745

View File

@ -1638,7 +1638,7 @@ visdump(char *dp, int datalen, int screenwidth)
printf(" \"");
col = 8;
for (;datalen > 0; datalen--, dp++) {
vis(visbuf, *dp, VIS_CSTYLE, *(dp+1));
vis(visbuf, *dp, VIS_CSTYLE | VIS_NOLOCALE, *(dp+1));
cp = visbuf;
/*
* Keep track of printables and