You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
char*greeting=get_greeting();
size_tgreeting_len=strlen(greeting); // Excludes null byte <-- Calling `strlen` before checking that greeting is non nullif (greeting!=NULL) {
We call strlen before checking that greeting is non-null, resulting in Undefined Behavior
The text was updated successfully, but these errors were encountered:
Ah, awesome catch! Would you like to PR a fix (probably move the strlen call into the if body)?
We could also add a sentence or two to the text noting that the strlen call must happen after the NULL check to avoid UB. Feels worth calling out in retrospect!
In the C code here https://highassurance.rs/chp4/attack_1.html#breaking-temporal-memory-safety-value-validity,
We call
strlen
before checking thatgreeting
is non-null, resulting in Undefined BehaviorThe text was updated successfully, but these errors were encountered: