OpenSC / pkcs11-helper

Library that simplifies the interaction with PKCS#11 providers for end-user applications using a simple API and optional OpenSSL engine
Other
66 stars 43 forks source link

Control may reach end of non-void function #28

Closed jkbullard closed 3 years ago

jkbullard commented 3 years ago

In the following function, which starts at line 1008 of pkcs11h-core.c, control will reach the end of a non-void function without returning a value if _WIN32 and ENABLE_PKCS11H_THREADING are not defined and _g_pkcs11h_data->safefork is false:

CK_RV
pkcs11h_forkFixup (void) {
#if defined(_WIN32)
    return CKR_OK;
#else
#if defined(ENABLE_PKCS11H_THREADING)
    return CKR_OK;
#else
    if (_g_pkcs11h_data->safefork) {
        return __pkcs11h_forkFixup ();
    }
#endif
#endif
}

Sorry, but I'm not familiar enough with the codebase to know if this is a serious problem, but if _g_pkcs11h_data->safefork is always true then the if statement isn't needed; otherwise something should be returned by this function.

alonbl commented 3 years ago

Thank you for the report. It should return ckr-ok, I will fix this.

On Tue, 17 Nov 2020 at 15:17 Tunnelblick developer notifications@github.com wrote:

In the following function, which starts at line 1008 of pkcs11h-core.c, control will reach the end of a non-void function without returning a value if _WIN32 and ENABLE_PKCS11H_THREADING are not defined and _g_pkcs11h_data->safefork is false:

CK_RV pkcs11h_forkFixup (void) {

if defined(_WIN32)

return CKR_OK;

else

if defined(ENABLE_PKCS11H_THREADING)

return CKR_OK;

else

if (_g_pkcs11h_data->safefork) { return __pkcs11h_forkFixup (); }

endif

endif

}

Sorry, but I'm not familiar enough with the codebase to know if this is a serious problem, but if _g_pkcs11h_data->safefork is always true then the if statement isn't needed; otherwise something should be returned by this function.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OpenSC/pkcs11-helper/issues/28, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJURLLTSFQ5GLNWCWUSIEDSQJZWFANCNFSM4TYR3P6A .

alonbl commented 3 years ago

Thanks! fixed in 1.27