diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | driver.c | 8 | ||||
-rw-r--r-- | fetchmail.h | 1 | ||||
-rw-r--r-- | imap.c | 2 | ||||
-rw-r--r-- | pop3.c | 4 | ||||
-rw-r--r-- | uid.c | 13 |
6 files changed, 26 insertions, 5 deletions
@@ -11,6 +11,9 @@ Release Notes: ------------------------------------------------------------------------------ +fetchmail-4.3.2 () +* More slow-UIDL patches from Wolfgang Wander. + fetchmail-4.3.1 (Mon Oct 13 17:12:40 EDT 1997) * Minor portation fixes for early AIX versions and NextSTEP. * Fixed a bad interaction between --limit and the repoll feature. @@ -49,7 +49,7 @@ #include <krb.h> #define krb_get_err_text(e) (krb_err_txt[e]) #else -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__linux__) #define krb_get_err_text(e) (krb_err_txt[e]) #include <krb.h> #include <des.h> @@ -751,9 +751,11 @@ int num; /* index of message */ { if( ctl->server.uidl ) { - char id[IDLEN+1]; + char id[IDLEN+1]; + /* prevent stack overflows */ + buf[IDLEN+12] = 0; sscanf( buf+12, "%s", id); - if( !str_in_list( &ctl->newsaved, id ) ) + if( !str_find( &ctl->newsaved, num ) ) save_str(&ctl->newsaved, num, id ); } } diff --git a/fetchmail.h b/fetchmail.h index 1ea49ae2..ed43b94a 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -269,6 +269,7 @@ void free_str_pair_list(struct idlist **); int delete_str(struct idlist **, int); int str_in_list(struct idlist **, const char *); int str_nr_in_list(struct idlist **, const char *); +int str_nr_last_in_list(struct idlist **, const char *); int count_list( struct idlist **idl ); char *str_from_nr_list( struct idlist **idl, int number ); char *str_find(struct idlist **, int); @@ -20,7 +20,7 @@ #include <des.h> #define krb_get_err_text(e) (krb_err_txt[e]) #endif -#if defined (__FreeBSD__) +#if defined (__FreeBSD__) || defined(__linux__) #define krb_get_err_text(e) (krb_err_txt[e]) #endif #include <krb.h> @@ -243,6 +243,8 @@ pop3_gettopid( int sock, int num , char *id) break; if( ! got_it && ! strncasecmp("Message-Id:", buf, 11 )) { got_it = 1; + /* prevent stack overflows */ + buf[IDLEN+12] = 0; sscanf( buf+12, "%s", id); } } @@ -284,7 +286,7 @@ pop3_slowuidl( int sock, struct query *ctl, int *countp, int *newp) if( (ok = pop3_gettopid( sock, try_id, id )) != 0 ) return ok; - try_nr = str_nr_in_list(&ctl->oldsaved, id); + try_nr = str_nr_last_in_list(&ctl->oldsaved, id); } else { try_id = *countp+1; try_nr = -1; @@ -197,6 +197,19 @@ int str_nr_in_list( struct idlist **idl, const char *str ) return -1; } +int str_nr_last_in_list( struct idlist **idl, const char *str ) + /* return the last position of str in idl */ +{ + int nr, ret = -1; + struct idlist *walk; + if ( !str ) + return -1; + for( walk = *idl, nr = 0; walk; nr ++, walk = walk->next ) + if( strcasecmp( str, walk->id) == 0 ) + ret = nr; + return ret; +} + int count_list( struct idlist **idl ) /* count the number of elements in the list */ { |