]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC r228636:
authordim <dim@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 1 Jan 2012 19:15:52 +0000 (19:15 +0000)
committerdim <dim@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 1 Jan 2012 19:15:52 +0000 (19:15 +0000)
commit5bedb362677aef1001fe96856ae54bcb747f79d9
tree74b763622a861995c0a7034b62504d212062be28
parented617e39f95557dbe188bc7d8bf7c10e5df57e20
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.

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