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

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


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

commit 6570e14d6723679c65a1f592485f17b39236a9a2
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 0c2c6aa5e6..54ac7c3451 100644
--- a/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
+++ b/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
@@ -266,7 +266,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