]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/commit
MFC r228636:
authortijl <tijl@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 13 Feb 2012 10:24:22 +0000 (10:24 +0000)
committertijl <tijl@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Mon, 13 Feb 2012 10:24:22 +0000 (10:24 +0000)
commitb8f9cab1ad3166d316d11661d6d8b1f94aaca1d4
tree9906025ec5e9366a33ade9b06dfc9f4f4e2d7b29
parentce1efa87a6e73557a33c75d0387d95f6debd1055
MFC r228636:

Correct a logic error in usr.bin/hexdump/conv.c, found by clang.

Whenever the conv_c() function encounters an incomplete multibyte char,
it peeks ahead.  It also sets p to peekbuf, to indicate it is still
processing the incomplete character.

However, on the next retry, it compares buf against peekbuf, which
always returns false, since both buf and peekbuf are local char arrays,
whose addresses are never the same.

Fix this by comparing against p instead, which was the intention.  Also
turn peekbuf into an array of u_char, to prevent conversion warnings.

MFC r229794:

- Fix how hexdump parses escape strings
From the NetBSD bug:
The way how hexdump(1) parses escape sequences has some bugs.
It shows up when an escape sequence is used as the non-last character
of a format string.

MFC r230649:

Fix decoding of escape sequences in format strings:
- Zero-terminate the resulting string by letting the for-loop copy the
  terminating zero.
- Exit the for-loop after handling a backslash at the end of the format
  string to fix a buffer overrun.
- Remove some unnecessary comments and blank lines.

PR: bin/144722

git-svn-id: svn://svn.freebsd.org/base/stable/8@231577 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
usr.bin/hexdump/conv.c
usr.bin/hexdump/parse.c