Re: [RFT, PATCH v1 1/1] hexdump: truncate output in case of overflow

2015-10-28 Thread Aaro Koskinen
Hi, On Wed, Oct 28, 2015 at 12:48:19PM +0200, Andy Shevchenko wrote: > There is a classical off-by-one error in case when we try to place, for > example, 1+1 bytes as hex in the buffer of size 6. The expected result is to > get an output truncated, but in the reality we get 6 bytes filed followed

[RFT, PATCH v1 1/1] hexdump: truncate output in case of overflow

2015-10-28 Thread Andy Shevchenko
There is a classical off-by-one error in case when we try to place, for example, 1+1 bytes as hex in the buffer of size 6. The expected result is to get an output truncated, but in the reality we get 6 bytes filed followed by terminating NUL. Change the logic how we fill the output in case of

Re: [RFT, PATCH v1 1/1] hexdump: truncate output in case of overflow

2015-10-28 Thread Aaro Koskinen
Hi, On Wed, Oct 28, 2015 at 12:48:19PM +0200, Andy Shevchenko wrote: > There is a classical off-by-one error in case when we try to place, for > example, 1+1 bytes as hex in the buffer of size 6. The expected result is to > get an output truncated, but in the reality we get 6 bytes filed followed

[RFT, PATCH v1 1/1] hexdump: truncate output in case of overflow

2015-10-28 Thread Andy Shevchenko
There is a classical off-by-one error in case when we try to place, for example, 1+1 bytes as hex in the buffer of size 6. The expected result is to get an output truncated, but in the reality we get 6 bytes filed followed by terminating NUL. Change the logic how we fill the output in case of