torproject / tor Public
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
Bug28223 diagnostic 035 #891
Merged
torproject-pusher
merged 4 commits into
torproject:maint-0.4.0
from
nmathewson:bug28223_diagnostic_035
Apr 18, 2019
Merged
Bug28223 diagnostic 035 #891
torproject-pusher
merged 4 commits into
torproject:maint-0.4.0
from
nmathewson:bug28223_diagnostic_035
Apr 18, 2019
Conversation
Try to figure out _where exactly_ we are first encountering NULs in microdescriptors, and what we are doing when that happens.
This is just in case there is some rogue platform that uses a nonstandard value for SEEK_*, and does not define that macro in unistd.h. I think that's unlikely, but it's conceivable.
Pull Request Test Coverage Report for Build 4741
|
teor2345
reviewed
Apr 15, 2019
src/feature/nodelist/microdesc.c
Outdated
| log_warn(LD_BUG, "About to dump a NUL into a microdescriptor file. " | ||
| "offset %"PRId64", bodylen %zu, nul position %zu", | ||
| (int64_t)md->off, md->bodylen, | ||
| (size_t)(nulpos - md->body)); |
Can we log the escaped() context of the NUL?
Maybe 10 bytes either side of the NUL?
Also, can we log some identifier from the microdescriptor?
I'll try to do the other stuff; at this stage, there is no identifier from the md that we could log.
teor2345
reviewed
Apr 15, 2019
src/feature/nodelist/microdesc.c
Outdated
| const char *nulpos = memchr(md->body, 0, md->bodylen); | ||
| if (BUG(nulpos)) { | ||
| log_warn(LD_BUG, "About to dump a NUL into a microdescriptor file. " | ||
| "offset %"PRId64", bodylen %zu, nul position %zu", |
Windows says:
"error: unknown conversion type character 'z' in format"
https://ci.appveyor.com/project/torproject/tor/builds/23576412/job/80p2k2cumplatqx9#L1468
teor2345
reviewed
Apr 15, 2019
src/feature/nodelist/microdesc.c
Outdated
| const char *nul_found = memchr(inp, 0, len); | ||
| if (BUG(nul_found)) { | ||
| log_warn(LD_BUG, "Found unexpected NUL while reading %s, at " | ||
| "position %zu/%zu.", |
Use TOR_PRIuSZ in place of %zu.
We need to encode here instead of doing escaped(), since fwict escaped() does not currently handle NUL bytes. Also, use warn_if_nul_found in more cases to avoid duplication.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
No description provided.
The text was updated successfully, but these errors were encountered: