-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libxo output breaks if buffer exceeds 8kb #37
Comments
I could be wrong, but it looks like the problem is caused by the call to xo_buf_has_room() not considering some part of the pretty printing: ALLAN: xo_buf_has_room: xb_size: 8192, curp: 8154, len: 12 It doesn't appear to expand the buffer until the cur pointer has passed the end of the buffer. |
Could you please retry with the current code? I fixed an embarrassingly bad issue in xo_vsnprintf:
in commit 1f66642 that’s part of libxo-0.3.3. IIRC the fix is in 0.3.2 also. But I’m fairly confident this was the issue you are seeing. Thanks,
|
I have 0.3.2 with that fix. The issue seems to be that the exact same bug exists in: ALLAN: xo_buf_has_room: xb_size: 8192, curp: 8166, len: 1 |
When checking the return value of vsnprintf, these functions compared against the size of the buffer, rather than the number of bytes remaining in the buffer, and so fail to grow the buffer when it was insufficient to fit the new content. Related to: 1f66642 Fixes: Juniper#37
Fixed in 0.3.4 |
While converting the FreeBSD procstat utility to libxo, I noticed that if the output exceeds 8kb, and stdout is a file or a pipe, the content is truncated.
to reproduce, run some command that produces more than 8192 bytes of data via libxo, and redirect stdout to a file, or pipe it to less or similar. The output will be truncated.
The text was updated successfully, but these errors were encountered: