Skip to content

Conversation

@bpintea
Copy link
Collaborator

@bpintea bpintea commented Nov 27, 2019

This PR fixes an underrun in the utility function copying a
wide-char string to the client application.

The impact is limited and it can only happen if the
received size of the client buffer is of the wrong size (<=0).

The PR also fixes a logging error happening if this function needs
to truncate the output. The macro for a format specifier with no
precision was provided instead of the needed one with precision. This
could potentially crash the client application in case the string to be
logged in not 0-terminated, logging is explicitely
enabled at an INFO (or higher) level and truncation needs to be applied

This commit fixes an underrun in the utility function copying a
wide-char string to the client application.

The impact is limited and it can only happen if the
received size of the client buffer is of the wrong size (<=0).

The commit also fixes a logging error happening if this function needs
to truncate the output. The macro for a format specifier with no
precision was provided instead of the needed one with precision. This
could potentially crash the client application in case the string to be
logged in not 0-terminated, logging is explicitely
enabled at an INFO (or higher) level and truncation needs to be applied
Copy link

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bpintea bpintea merged commit ea2814b into elastic:master Nov 28, 2019
@bpintea bpintea deleted the fix/write_wstr_check_room branch November 28, 2019 10:15
bpintea added a commit that referenced this pull request Nov 28, 2019
This commit fixes an underrun in the utility function copying a
wide-char string to the client application.

The impact is limited and it can only happen if the
received size of the client buffer is of the wrong size (<=0).

The commit also fixes a logging error happening if this function needs
to truncate the output. The macro for a format specifier with no
precision was provided instead of the needed one with precision. This
could potentially crash the client application in case the string to be
logged in not 0-terminated, logging is explicitely
enabled at an INFO (or higher) level and truncation needs to be applied

(cherry picked from commit ea2814b)
bpintea added a commit that referenced this pull request Dec 2, 2019
This commit fixes an underrun in the utility function copying a
wide-char string to the client application.

The impact is limited and it can only happen if the
received size of the client buffer is of the wrong size (<=0).

The commit also fixes a logging error happening if this function needs
to truncate the output. The macro for a format specifier with no
precision was provided instead of the needed one with precision. This
could potentially crash the client application in case the string to be
logged in not 0-terminated, logging is explicitely
enabled at an INFO (or higher) level and truncation needs to be applied

(cherry picked from commit ea2814b)
bpintea added a commit that referenced this pull request Dec 4, 2019
This commit fixes an underrun in the utility function copying a
wide-char string to the client application.

The impact is limited and it can only happen if the
received size of the client buffer is of the wrong size (<=0).

The commit also fixes a logging error happening if this function needs
to truncate the output. The macro for a format specifier with no
precision was provided instead of the needed one with precision. This
could potentially crash the client application in case the string to be
logged in not 0-terminated, logging is explicitely
enabled at an INFO (or higher) level and truncation needs to be applied

(cherry picked from commit ea2814b)

Merge conflicts:
- test/test_util.cc
fixed by removing test for utf8_to_wstr(), not present in 6.x.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants