-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Condition always false in x509_get_subject_alt_name #2802
Comments
The check is in fact redundant, but I disagree with the explanation. |
@k-stachowiak
You are right here. Idea of treating pointers as unsigned remained from old times; now this is implementation defined.
Or if the difference is above maximum positive value for |
FIx one comment. Signed-off-by: irwir <[email protected]>
FIx one comment. Signed-off-by: irwir <[email protected]>
FIx one comment. Signed-off-by: irwir <[email protected]>
Comparing with zero could be slightly more efficient, but also it is easier to understand.
https://github.com/ARMmbed/mbedtls/blob/beec142010cd9f3a967a9a3a7b407b51841b542e/library/x509_crt.c#L648
It might be guessed that the intention was to check
end>=*p
, but the values are pointers, and thus unsigned.In pointer arithmetics anything less than 1 is nothing but 0.
Hence the condition means
end == *p
,In any case, the loop header ensures that
*p < end
.The text was updated successfully, but these errors were encountered: