RFR [XS]: 8239457: call ReleaseStringUTFChars before early returns in Java_sun_security_pkcs11_wrapper_PKCS11_connect

Baesken, Matthias matthias.baesken at sap.com
Fri Feb 21 13:01:08 UTC 2020


Thanks ! May I get a second review ?

Best regards, Matthias



From: Langer, Christoph <christoph.langer at sap.com>
Sent: Freitag, 21. Februar 2020 13:47
To: Baesken, Matthias <matthias.baesken at sap.com>; security-dev at openjdk.java.net
Subject: RE: RFR [XS]: 8239457: call ReleaseStringUTFChars before early returns in Java_sun_security_pkcs11_wrapper_PKCS11_connect

Hi Matthias,

this looks correct. Thanks for taking care of it.

Best regards
Christoph

From: Baesken, Matthias <matthias.baesken at sap.com<mailto:matthias.baesken at sap.com>>
Sent: Freitag, 21. Februar 2020 13:18
To: security-dev at openjdk.java.net<mailto:security-dev at openjdk.java.net>
Cc: Langer, Christoph <christoph.langer at sap.com<mailto:christoph.langer at sap.com>>
Subject: RE: RFR [XS]: 8239457: call ReleaseStringUTFChars before early returns in Java_sun_security_pkcs11_wrapper_PKCS11_connect

Ping - any reviews please ?

Best regards, Matthias


From: Baesken, Matthias
Sent: Mittwoch, 19. Februar 2020 13:55
To: security-dev at openjdk.java.net<mailto:security-dev at openjdk.java.net>
Subject: RFR [XS]: 8239457: call ReleaseStringUTFChars before early returns in Java_sun_security_pkcs11_wrapper_PKCS11_connect

Hello, please review this small  change to  unix  Java_sun_security_pkcs11_wrapper_PKCS11_connect .
Here we miss a call to ReleaseStringUTFChars  before early returns , e.g.  these early returns .


127     // with the old JAR file jGetFunctionList is null, temporarily check for that
128     if (jGetFunctionList != NULL) {
129         getFunctionListStr = (*env)->GetStringUTFChars(env, jGetFunctionList, 0);
130         if (getFunctionListStr == NULL) {
131             return;
132         }
 ...
 135     }
136     if (C_GetFunctionList == NULL) {
137         throwIOException(env, "ERROR: C_GetFunctionList == NULL");
138         return;
139     } else if ( (systemErrorMessage = dlerror()) != NULL ){
140         throwIOException(env, systemErrorMessage);
141         return;
142     }

Fix is to move the last call to (*env)->ReleaseStringUTFChars(env, jPkcs11ModulePath, libraryNameStr);
Some lines  forward in the function  Java_sun_security_pkcs11_wrapper_PKCS11_connect .


Bug/webrev :

https://bugs.openjdk.java.net/browse/JDK-8239457

http://cr.openjdk.java.net/~mbaesken/webrevs/8239457.0/


Thanks, Matthias

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/security-dev/attachments/20200221/3e511470/attachment.htm>


More information about the security-dev mailing list