diff options
author | Ezra Peisach <epeisach@mit.edu> | 2009-06-06 13:46:06 +0000 |
---|---|---|
committer | Ezra Peisach <epeisach@mit.edu> | 2009-06-06 13:46:06 +0000 |
commit | 9321b02aabf84439e1d69f387f9ddf7433892e5e (patch) | |
tree | 935f2c023b08b15057f63b9605aa4c05ce777659 /src/lib/kadm5/srv | |
parent | 58989d37a8ce50e04452cdab47b897765a7e7d4e (diff) | |
download | krb5-9321b02aabf84439e1d69f387f9ddf7433892e5e.zip krb5-9321b02aabf84439e1d69f387f9ddf7433892e5e.tar.gz krb5-9321b02aabf84439e1d69f387f9ddf7433892e5e.tar.bz2 |
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...
ticket: 6509
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22403 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/kadm5/srv')
-rw-r--r-- | src/lib/kadm5/srv/server_acl.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/lib/kadm5/srv/server_acl.c b/src/lib/kadm5/srv/server_acl.c index 7622044..fd245ba 100644 --- a/src/lib/kadm5/srv/server_acl.c +++ b/src/lib/kadm5/srv/server_acl.c @@ -238,20 +238,24 @@ kadm5int_acl_parse_line(lp) 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); - } - else { - acle->ae_restriction_string = (char *) NULL; + + 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; } - acle->ae_restriction_bad = 0; - acle->ae_restrictions = (restriction_t *) NULL; } } DPRINT(DEBUG_CALLS, acl_debug_level, |