feat(common): add wpa_hexdump_ascii function - #440
Merged
Conversation
Add `wpa_hexdump_ascii` to match the API of `wpa_hexdump_ascii()` from hostap. Please note that this function acts differently from the hostap version of the function: - It only prints the first 15 bytes. - It prints all bytes as hex, never as ASCII. Co-authored-by: Alexandru Mereacre <mereacre@gmail.com>
wpa_hexdump_ascii() currently uses a 32-byte output buffer when calling `printf_hex()`. However, `printf_hex()` must have a odd-number sized buffer to avoid truncating the hexstring in the middle of a byte, as the output buffer string must be NUL-terminated. Changing the hex buffer size to 33-bytes prevents a mid-byte truncation.
Codecov Report
@@ Coverage Diff @@
## main #440 +/- ##
==========================================
+ Coverage 53.08% 53.09% +0.01%
==========================================
Files 144 144
Lines 19870 19876 +6
==========================================
+ Hits 10547 10553 +6
Misses 9323 9323
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
wpa_hexdump_asciito match the API ofwpa_hexdump_ascii()from hostap.Please note that this function acts differently from the hostap version of the function:
Adapted from commit dff384c.
My changes compared to dff384c:
__maybe_unused(from 5a3a8bf) to mark the unusedlevelparam.NUL-terminator too (see 24fe4cb for more information), otherwiseprintf_hexcauses a mid-byte truncation issue.