fix: add const correctness to S2N_BLOB_LABEL macro #5566
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.
The S2N_BLOB_LABEL macro creates const blob structures but the underlying data array was not marked const, breaking const-correctness. so the data will be modified even though the blob is const. CHange the data array as const in S2N_BLOB_LABEL macro & add cast to maintain surity with non-const data pointer
Release Summary:
Fixes const-correctness in S2N_BLOB_LABEL macro to prevent modification of immutable TLS protocol label strings.
Testing:
How is this change tested (unit tests, fuzz tests, etc.)? What manual testing was performed? Are there any testing steps to be verified by the reviewer?
How can you convince your reviewers that this PR is safe and effective?
Is this a refactor change? If so, how have you proved that the intended behavior hasn't changed?
all tests using S2N_BLOB_LABEL validate this change (s2n_tls13_prf_test.c, s2n_tls13_record_aead_test.c, all TLS 1.3 tests using labels from crypto/s2n_tls13_keys.c)
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.