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 12:17:32 UTC 2020


Ping - any reviews please ?

Best regards, Matthias


From: Baesken, Matthias
Sent: Mittwoch, 19. Februar 2020 13:55
To: 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.org/pipermail/security-dev/attachments/20200221/c811c185/attachment.htm>


More information about the security-dev mailing list