Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Zyad Hassan <[email protected]>
  • Loading branch information
celinval and zhassan-aws authored Nov 4, 2024
1 parent 38312fb commit 44ce7cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doc/src/challenges/0013-cstr.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ a security risk for their users.

## Description

The goal of this challenge is to ensure the safety of the CStr struct implementation.
The goal of this challenge is to ensure the safety of the `CStr` struct implementation.
First, we need to specify a safety invariant that captures the essential safety properties that must be maintained.

Next, we should verify that all the safe, public methods respect this invariant.
For example, we can check that creating a `CStr` from a byte slice with method `from_bytes_with_nul` will only yield
safe values of `CStr`.

Finally, for unsafe methods like `as_ptr()` and `from_ptr()`, we need to specify appropriate safety contracts.
Finally, for unsafe methods like `from_ptr()` and `from_bytes_with_nul_unchecked`, we need to specify appropriate safety contracts.
These contracts should ensure no undefined behavior occurs within the unsafe methods themselves,
and that they maintain the overall safety invariant of `CStr` when called correctly.

Expand Down

0 comments on commit 44ce7cf

Please sign in to comment.