Fix seg fault when enumerating the nss database, 544584, r=rrelyea
authoremaldona%redhat.com
Sat, 06 Feb 2010 04:48:56 +0000
changeset 9543 bfa523055b5239b4f30533dd8d6cb2c7ca1c3a11
parent 9541 bce3aa63c58be9dd24015cf9ce42567ec758e591
child 9544 b70ccde4445542a1bb2c2abc9a51c89bc251d6a2
push idunknown
push userunknown
push dateunknown
reviewersrrelyea
bugs544584
Fix seg fault when enumerating the nss database, 544584, r=rrelyea
security/nss/lib/pk11wrap/pk11pars.c
--- a/security/nss/lib/pk11wrap/pk11pars.c
+++ b/security/nss/lib/pk11wrap/pk11pars.c
@@ -1129,16 +1129,22 @@ SECMOD_LoadModule(char *modulespec,SECMO
 
 	    index = moduleSpecList;
 	    if (*index && SECMOD_GetSkipFirstFlag(module)) {
 		index++;
 	    }
 
 	    for (; *index; index++) {
 		SECMODModule *child;
+		if (0 == PORT_Strcmp(*index, modulespec)) {
+		    /* avoid trivial infinite recursion */
+		    PORT_SetError(SEC_ERROR_NO_MODULE);
+		    rv = SECFailure;
+		    break;
+		}
 		child = SECMOD_LoadModule(*index,module,PR_TRUE);
 		if (!child) break;
 		if (child->isCritical && !child->loaded) {
 		    int err = PORT_GetError();
 		    if (!err)  
 			err = SEC_ERROR_NO_MODULE;
 		    SECMOD_DestroyModule(child);
 		    PORT_SetError(err);