+2005-11-06 [colin] 1.9.99cvs13
+
+ * src/ldif.c
+ Fix ldif_get_line() that returned empty strings
+ (Didn't understand why). Also fix a possible
+ buffer overflow.
+
2005-11-06 [wwp] 1.9.99cvs12
* src/textview.c
( cvs diff -u -r 1.4.2.22 -r 1.4.2.23 src/gtk/about.c; ) > 1.9.99cvs10.patchset
( cvs diff -u -r 1.4.2.23 -r 1.4.2.24 src/gtk/about.c; ) > 1.9.99cvs11.patchset
( cvs diff -u -r 1.96.2.82 -r 1.96.2.83 src/textview.c; cvs diff -u -r 1.4.2.24 -r 1.4.2.25 src/gtk/about.c; cvs diff -u -r 1.5.2.16 -r 1.5.2.17 src/gtk/gtkutils.c; cvs diff -u -r 1.4.2.14 -r 1.4.2.15 src/gtk/gtkutils.h; ) > 1.9.99cvs12.patchset
+( cvs diff -u -r 1.12.2.4 -r 1.12.2.5 src/ldif.c; ) > 1.9.99cvs13.patchset
static gchar *ldif_get_line( LdifFile *ldifFile ) {
gchar buf[ LDIFBUFSIZE ];
gint ch;
- gchar *ptr;
+ int i = 0;
- if( feof( ldifFile->file ) ) return NULL;
+ if( feof( ldifFile->file ) )
+ return NULL;
- ptr = buf;
- while( TRUE ) {
- *ptr = '\0';
+ while( i < LDIFBUFSIZE-1 ) {
ch = fgetc( ldifFile->file );
if( ch == '\0' || ch == EOF ) {
- if( *buf == '\0' ) return NULL;
+ if( i == 0 ) return NULL;
break;
}
#if HAVE_DOSISH_SYSTEM
#else
- if( ch == '\r' ) continue;
+ if( ch == '\r' )
+ continue;
#endif
- if( ch == '\n' ) break;
- *ptr = ch;
- ptr++;
+ if( ch == '\n' )
+ break;
+ buf[i] = ch;
+ i++;
}
+ buf[i] = '\0';
/* Return a copy of buffer */
return g_strdup( buf );
/* Process file */
while( ! flagEOF ) {
gchar *line = ldif_get_line( ldifFile );
-
posCur = ftell( ldifFile->file );
if( ldifFile->cbProgress ) {
/* Call progress indicator */
if( tagName ) {
/* Add tag to list */
listTags = g_slist_append( listTags, tagName );
+
if( g_utf8_collate(
tagName, LDIF_TAG_EMAIL ) == 0 )
{