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

LDIF continuation line bug (ITS#302)



Full_Name: Paul Richards
Version: 1.2.7
OS: FreeBSD
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (194.217.50.234)


The ldif library function str_getline() in line64.c converts a continuation line
into a single non-space binary character and will return a valid string
containing that one character.

When this string is passed to str_parse_line() the code that removes
continuation lines is after the code that checks whether the value is null. This
means that str_parse_line(), instead of returning an error returns a valid
attribute of length 0.

Removing the continuation character before checking for null length fixes the
problem. Diff included below.

--- line64.c	Tue Mar  2 18:30:05 1999
+++ /a/home/paul/ldap/libraries/libldif/line64.c	Fri Sep 24 00:22:30 1999
@@ -93,18 +93,18 @@
 		s++;
 	}
 
-	/* if no value is present, error out */
-	if ( *s == '\0' ) {
-		Debug( LDAP_DEBUG_PARSE, "parse_line missing value\n", 0,0,0 );
-		return( -1 );
-	}
-
 	/* check for continued line markers that should be deleted */
 	for ( p = s, d = s; *p; p++ ) {
 		if ( *p != CONTINUED_LINE_MARKER )
 			*d++ = *p;
 	}
 	*d = '\0';
+
+	/* if no value is present, error out */
+	if ( *s == '\0' ) {
+		Debug( LDAP_DEBUG_PARSE, "parse_line missing value\n", 0,0,0 );
+		return( -1 );
+	}
 
 	*value = s;
 	if ( b64 ) {