mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-04-12 15:10:31 +08:00
ITS#7859 refix
This was actually broken by 65e163d2, ITS#6947. Reverting both of those changes and fixing #6947 again.
This commit is contained in:
parent
eb5faf5928
commit
189f312d64
@ -838,20 +838,24 @@ ldif_read_record(
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( stop )
|
||||
break;
|
||||
|
||||
if ( fgets( line, sizeof( line ), lfp->fp ) == NULL ) {
|
||||
stop = 1;
|
||||
len = 0;
|
||||
} else {
|
||||
len = strlen( line );
|
||||
if ( !stop ) {
|
||||
if ( fgets( line, sizeof( line ), lfp->fp ) == NULL ) {
|
||||
stop = 1;
|
||||
len = 0;
|
||||
} else {
|
||||
len = strlen( line );
|
||||
}
|
||||
}
|
||||
|
||||
if ( len == 0 || line[len-1] != '\n' ) {
|
||||
/* Add \n in case the line/file does not end with newline */
|
||||
line[len] = '\n';
|
||||
line[++len] = '\0';
|
||||
if ( stop ) {
|
||||
/* Add \n in case the file does not end with newline */
|
||||
if (last_ch != '\n') {
|
||||
len = 1;
|
||||
line[0] = '\n';
|
||||
line[1] = '\0';
|
||||
goto last;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* Squash \r\n to \n */
|
||||
@ -920,9 +924,10 @@ ldif_read_record(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
last:
|
||||
if ( *buflenp - lcur <= len ) {
|
||||
*buflenp += len + LDIF_MAXLINE;
|
||||
nbufp = ber_memrealloc( *bufp, *buflenp );
|
||||
|
Loading…
x
Reference in New Issue
Block a user