summaryrefslogtreecommitdiff
authoralwin <alwin>2003-12-10 12:45:01 (UTC)
committer alwin <alwin>2003-12-10 12:45:01 (UTC)
commit66aa51039689ab2dab153469d7f6527bcedd9318 (patch) (side-by-side diff)
treed27e68fa02af9c50514b9d9effcd67e28b86f66d
parentb09fe710918a447f37c7ec92a6becb9953ada063 (diff)
downloadopie-66aa51039689ab2dab153469d7f6527bcedd9318.zip
opie-66aa51039689ab2dab153469d7f6527bcedd9318.tar.gz
opie-66aa51039689ab2dab153469d7f6527bcedd9318.tar.bz2
when login failed for pop3 software crashed due not checked NULL pointer
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/pop3wrapper.cpp1
-rw-r--r--noncore/net/mail/pop3wrapper.cpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
index 2aaff30..72f3c36 100644
--- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
+++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp
@@ -1,61 +1,62 @@
#include "pop3wrapper.h"
#include "mailtypes.h"
#include <libetpan/mailpop3.h>
POP3wrapper::POP3wrapper( POP3account *a )
{
account = a;
m_pop3 = NULL;
}
POP3wrapper::~POP3wrapper()
{
logout();
}
void POP3wrapper::pop3_progress( size_t current, size_t maximum )
{
qDebug( "POP3: %i of %i", current, maximum );
}
void POP3wrapper::listMessages( QList<RecMail> &target )
{
int err = MAILPOP3_NO_ERROR;
char *header;
size_t length;
carray *messages;
login();
+ if (!m_pop3) return;
mailpop3_list( m_pop3, &messages );
for ( int i = carray_count( messages ); i > 0; i-- ) {
mailpop3_msg_info *info = (mailpop3_msg_info *) carray_get( messages, i - 1 );
err = mailpop3_header( m_pop3, info->index, &header, &length );
if ( err != MAILPOP3_NO_ERROR ) {
qDebug( "POP3: error retrieving header msgid: %i", info->index );
logout();
return;
}
RecMail *mail = parseHeader( header );
mail->setNumber( info->index );
target.append( mail );
}
logout();
}
RecMail *POP3wrapper::parseHeader( const char *header )
{
int err = MAILIMF_NO_ERROR;
size_t curTok;
RecMail *mail = new RecMail();
mailimf_fields *fields;
err = mailimf_fields_parse( (char *) header, strlen( header ), &curTok, &fields );
for ( clistiter *current = clist_begin( fields->list ); current != NULL; current = current->next ) {
mailimf_field *field = (mailimf_field *) current->data;
switch ( field->type ) {
case MAILIMF_FIELD_FROM:
mail->setFrom( *parseMailboxList( field->field.from->mb_list ) );
diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp
index 2aaff30..72f3c36 100644
--- a/noncore/net/mail/pop3wrapper.cpp
+++ b/noncore/net/mail/pop3wrapper.cpp
@@ -1,61 +1,62 @@
#include "pop3wrapper.h"
#include "mailtypes.h"
#include <libetpan/mailpop3.h>
POP3wrapper::POP3wrapper( POP3account *a )
{
account = a;
m_pop3 = NULL;
}
POP3wrapper::~POP3wrapper()
{
logout();
}
void POP3wrapper::pop3_progress( size_t current, size_t maximum )
{
qDebug( "POP3: %i of %i", current, maximum );
}
void POP3wrapper::listMessages( QList<RecMail> &target )
{
int err = MAILPOP3_NO_ERROR;
char *header;
size_t length;
carray *messages;
login();
+ if (!m_pop3) return;
mailpop3_list( m_pop3, &messages );
for ( int i = carray_count( messages ); i > 0; i-- ) {
mailpop3_msg_info *info = (mailpop3_msg_info *) carray_get( messages, i - 1 );
err = mailpop3_header( m_pop3, info->index, &header, &length );
if ( err != MAILPOP3_NO_ERROR ) {
qDebug( "POP3: error retrieving header msgid: %i", info->index );
logout();
return;
}
RecMail *mail = parseHeader( header );
mail->setNumber( info->index );
target.append( mail );
}
logout();
}
RecMail *POP3wrapper::parseHeader( const char *header )
{
int err = MAILIMF_NO_ERROR;
size_t curTok;
RecMail *mail = new RecMail();
mailimf_fields *fields;
err = mailimf_fields_parse( (char *) header, strlen( header ), &curTok, &fields );
for ( clistiter *current = clist_begin( fields->list ); current != NULL; current = current->next ) {
mailimf_field *field = (mailimf_field *) current->data;
switch ( field->type ) {
case MAILIMF_FIELD_FROM:
mail->setFrom( *parseMailboxList( field->field.from->mb_list ) );