[Date Prev][Date Next] [Chronological] [Thread] [Top]

slapd segfaults on illegal schema (ITS#2342)



Full_Name: Peter Marschall
Version: 2.1.14
OS: Linux
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (213.68.23.10)


slapd dies with a SIGSEGV when it comes across an illegal schema like
  objectClass
  (
or
  attributeType
  (

The reason for this is an unchecked access to memory in server/slapd/config.c
Here is a patch that should solve the problem (and print a nicer error message
too ;-)

--- servers/slapd/config.c-old  Mon Mar  3 10:37:06 2003
+++ servers/slapd/config.c      Mon Mar  3 10:50:22 2003
@@ -1505,7 +1505,7 @@

                /* specify an objectclass */
                } else if ( strcasecmp( cargv[0], "objectclass" ) == 0 ) {
-                       if ( *cargv[1] == '('  /*')'*/) {
+                       if ( cargc > 1 && *cargv[1] == '('  /*')'*/) {
                                char * p;
                                p = strchr(saveline,'(' /*')'*/);
                                rc = parse_oc( fname, lineno, p, cargv );
@@ -1514,11 +1514,11 @@
                        } else {
 #ifdef NEW_LOGGING
                                LDAP_LOG( CONFIG, INFO,
-                                       "%s: line %d: old objectclass format not
supported\n",
+                                       "%s: line %d: illegal objectclass
format.\n",
                                        fname, lineno , 0 );
 #else
                                Debug( LDAP_DEBUG_ANY,
-                                      "%s: line %d: old objectclass format not
supported.\n",
+                                      "%s: line %d: illegal objectclass
format.\n",
                                       fname, lineno, 0 );
 #endif
                        }
@@ -1535,7 +1535,7 @@
                } else if (( strcasecmp( cargv[0], "attributetype" ) == 0 )
                        || ( strcasecmp( cargv[0], "attribute" ) == 0 ))
                {
-                       if ( *cargv[1] == '(' /*')'*/) {
+                       if ( cargc > 1 && *cargv[1] == '(' /*')'*/) {
                                char * p;
                                p = strchr(saveline,'(' /*')'*/);
                                rc = parse_at( fname, lineno, p, cargv );
@@ -1544,11 +1544,11 @@
                        } else {
 #ifdef NEW_LOGGING
                                LDAP_LOG( CONFIG, INFO,
-                                       "%s: line %d: old attribute type format
not supported.\n",
+                                       "%s: line %d: illegal attribute type
format.\n",
                                        fname, lineno , 0 );
 #else
                                Debug( LDAP_DEBUG_ANY,
-    "%s: line %d: old attribute type format not supported.\n",
+    "%s: line %d: illegal attribute type format.\n",
                                    fname, lineno, 0 );
 #endif