Commit 4e2031ca authored by Pavel Emelyanov's avatar Pavel Emelyanov

show: Don't print out-of-buffer-range symbols

The print_data helper may access symbols beyond the buffer
range and would thus print trash.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 255d9851
......@@ -55,14 +55,21 @@ static int nice_width_for(unsigned long addr)
static inline void pr_xdigi(unsigned char *data, size_t len, int pos)
{
pr_msg("%02x ", data[pos]);
if (pos < len)
pr_msg("%02x ", data[pos]);
else
pr_msg(" ");
}
static inline void pr_xsym(unsigned char *data, size_t len, int pos)
{
char sym;
sym = data[pos];
if (pos < len)
sym = data[pos];
else
sym = ' ';
pr_msg("%c", isprint(sym) ? sym : '.');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment