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

signature parse: check for strtol error through errno #126

Closed
wants to merge 1 commit into from

Conversation

carlosmn
Copy link
Member

@carlosmn carlosmn commented Apr 7, 2011

strtol can return 0 on success. Check if errno is set to determine
object corruption.

Signed-off-by: Carlos Martín Nieto cmn@elego.de

strtol can return 0 on success. Check if errno is set to determine
object corruption.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
@carlosmn
Copy link
Member Author

carlosmn commented Apr 7, 2011

If we know that there is no space before the timestamp, we could also check to see if the buffer has moved, but in this case I think we in fact know there is at least one space.

@vmg
Copy link
Member

vmg commented Apr 9, 2011

Hey, thanks for spotting this, but the fix is not valid: the POSIX standard doesn't require errno to be set when strtol fails. I've fixed this by adding a custom strol implementation that does proper error checking. Cheers!

@vmg vmg closed this Apr 9, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants