Skip to content

sectransp: EXC_BAD_ACCESS caused by non deterministic value#7126

Closed
ebeworld wants to merge 8 commits intocurl:masterfrom
ebeworld:master
Closed

sectransp: EXC_BAD_ACCESS caused by non deterministic value#7126
ebeworld wants to merge 8 commits intocurl:masterfrom
ebeworld:master

Conversation

@ebeworld
Copy link

We have following code in Curl.
...
SecCertificateCopyCommonName(cert, &common_name);
#endif
if(CFStringCompare(common_name, label_cf, 0) == kCFCompareEqualTo)

When the SecCertificateCopyCommonName function fails, it does not have to leave common_name in valid, state. So CFStringCompare is using the invalid result, hence causing EXC_BAD_ACCESS.

Fix is to check return value of the function.

ebejan and others added 2 commits May 24, 2021 23:38
We have following code in Curl.
...
 SecCertificateCopyCommonName(cert, &common_name);
#endif
          if(CFStringCompare(common_name, label_cf, 0) == kCFCompareEqualTo)

When the SecCertificateCopyCommonName function fails, it does not have to leave common_name in valid, state. So CFStringCompare is using the invalid result, hence causing EXC_BAD_ACCESS.

Fix is to check return value of the function.
EXC_BAD_ACCESS caused by non deterministic value
@ebeworld ebeworld closed this May 25, 2021
@bagder bagder changed the title EXC_BAD_ACCESS caused by non deterministic value sectransp: EXC_BAD_ACCESS caused by non deterministic value May 25, 2021
@bagder bagder added the TLS label May 25, 2021
@ebeworld ebeworld reopened this May 25, 2021
@bagder
Copy link
Member

bagder commented May 25, 2021

$ make checksrc
...
./vtls/sectransp.c:1167:103: warning: Longer than 79 columns (LONGLINE)
           if(copy_status == noErr && CFStringCompare(common_name, label_cf, 0) == kCFCompareEqualTo) {
checksrc: 0 errors and 1 warnings

@ebeworld ebeworld requested a review from bagder May 25, 2021 08:32
@bagder
Copy link
Member

bagder commented May 25, 2021

Thanks!

@bagder bagder closed this in a63dae5 May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants