Skip to content
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

Fix an integer underflow. #783

Merged
merged 1 commit into from Nov 12, 2015
Merged

Fix an integer underflow. #783

merged 1 commit into from Nov 12, 2015

Conversation

@hannob
Copy link
Contributor

@hannob hannob commented Nov 12, 2015

The reason is that the function return value is a -1 on error, however
the variable to store that is unsigned, therefore it is unable to store
the error value and will underflow. The subsequent check will therefore
not catch the error.
To fix this change content_len from gsize (unsigned) to gssigned
(signed).

This was found with Address Sanitizer.

Fixes #780

@nvxxu2i
Copy link
Contributor

@nvxxu2i nvxxu2i commented Nov 12, 2015

👍

@bazsi
Copy link
Collaborator

@bazsi bazsi commented Nov 12, 2015

patch itself is great, thanks patching it, 👍

on the other hand could you pls fix the subject of the patch (just add an afsocket: prefix, that should be enough) and a "signed-off-by:" tag at the end.

Thanks.

The reason is that the function return value is a -1 on error, however
the variable to store that is unsigned, therefore it is unable to store
the error value and will underflow. The subsequent check will therefore
not catch the error.
To fix this change content_len from gsize (unsigned) to gssigned
(signed).

This was found with Address Sanitizer.

Signed-off-by: Hanno Böck <hanno@hboeck.de>
@hannob hannob force-pushed the hannob:master branch to ada1232 Nov 12, 2015
@hannob
Copy link
Contributor Author

@hannob hannob commented Nov 12, 2015

done that

bazsi added a commit that referenced this pull request Nov 12, 2015
Fix an integer underflow.
@bazsi bazsi merged commit b2188e5 into syslog-ng:master Nov 12, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@nvxxu2i nvxxu2i added this to the syslog-ng-3.8beta1 milestone Mar 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.