This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new d25f2a33d1 Fix possible NPE
d25f2a33d1 is described below

commit d25f2a33d18e349587f16dfb4e32629825b005ee
Author: remm <r...@apache.org>
AuthorDate: Mon Sep 11 11:46:17 2023 +0200

    Fix possible NPE
    
    Found by coverity.
---
 java/org/apache/catalina/realm/JAASMemoryLoginModule.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/realm/JAASMemoryLoginModule.java 
b/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
index 5ede590c04..1fd058b439 100644
--- a/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
+++ b/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
@@ -265,7 +265,8 @@ public class JAASMemoryLoginModule extends MemoryRealm 
implements LoginModule {
         try {
             callbackHandler.handle(callbacks);
             username = ((NameCallback) callbacks[0]).getName();
-            password = new String(((PasswordCallback) 
callbacks[1]).getPassword());
+            char[] passwordArray = ((PasswordCallback) 
callbacks[1]).getPassword();
+            password = (passwordArray == null) ? null : new 
String(passwordArray);
             nonce = ((TextInputCallback) callbacks[2]).getText();
             nc = ((TextInputCallback) callbacks[3]).getText();
             cnonce = ((TextInputCallback) callbacks[4]).getText();


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to