svn rev #22403: trunk/src/lib/kadm5/srv/

epeisach@MIT.EDU epeisach at MIT.EDU
Sat Jun 6 09:46:07 EDT 2009


http://src.mit.edu/fisheye/changelog/krb5/?cs=22403
Commit By: epeisach
Log Message:
ticket: 6509
subject: kadmind is parsing acls good deref NULL pointer on error

In kadm5int_acl_parse_line, if you setup an acl w/ restrictions
(i.e. the four argument acl format) - but have an error parsing the
first few fields, acle is NULLed out, and is then derefed.

This adds a conditional and indents according to the krb5 c-style...





Changed Files:
U   trunk/src/lib/kadm5/srv/server_acl.c
Modified: trunk/src/lib/kadm5/srv/server_acl.c
===================================================================
--- trunk/src/lib/kadm5/srv/server_acl.c	2009-06-06 03:55:44 UTC (rev 22402)
+++ trunk/src/lib/kadm5/srv/server_acl.c	2009-06-06 13:46:06 UTC (rev 22403)
@@ -238,20 +238,24 @@
 		free(acle);
 		acle = (aent_t *) NULL;
 	    }
-	    if ( nmatch >= 4 ) {
-		char	*trailing;
 
-		trailing = &acle_restrictions[strlen(acle_restrictions)-1];
-		while ( isspace((int) *trailing) )
-		    trailing--;
-		trailing[1] = '\0';
-		acle->ae_restriction_string = strdup(acle_restrictions);
+	    if (acle) {
+		    if ( nmatch >= 4 ) {
+			    char	*trailing;
+			    
+			    trailing = &acle_restrictions[strlen(acle_restrictions)-1];
+			    while ( isspace((int) *trailing) )
+				    trailing--;
+			    trailing[1] = '\0';
+			    acle->ae_restriction_string = 
+				    strdup(acle_restrictions);
+		    }
+		    else {
+			    acle->ae_restriction_string = (char *) NULL;
+		    }
+		    acle->ae_restriction_bad = 0;
+		    acle->ae_restrictions = (restriction_t *) NULL;
 	    }
-	    else {
-		acle->ae_restriction_string = (char *) NULL;
-	    }
-	    acle->ae_restriction_bad = 0;
-	    acle->ae_restrictions = (restriction_t *) NULL;
 	}
     }
     DPRINT(DEBUG_CALLS, acl_debug_level,




More information about the cvs-krb5 mailing list