comparison src/libpst.c @ 110:7133b39975f7 stable-0-6-22

patch from David Cuadrado to process emails with type PST_TYPE_OTHER base64_encode_multiple() may insert newline, needs larger malloc subject lines shorter than 2 bytes could segfault
author Carl Byington <carl@five-ten-sg.com>
date Fri, 28 Nov 2008 11:36:53 -0800
parents 4703d622e95b
children e213bfcf9aa7
comparison
equal deleted inserted replaced
109:7947334d53ad 110:7133b39975f7
1873 MALLOC_EMAIL(item); 1873 MALLOC_EMAIL(item);
1874 item->email->subject = (pst_item_email_subject*) realloc(item->email->subject, sizeof(pst_item_email_subject)); 1874 item->email->subject = (pst_item_email_subject*) realloc(item->email->subject, sizeof(pst_item_email_subject));
1875 memset(item->email->subject, 0, sizeof(pst_item_email_subject)); 1875 memset(item->email->subject, 0, sizeof(pst_item_email_subject));
1876 DEBUG_EMAIL((" [size = %i] ", list->items[x]->size)); 1876 DEBUG_EMAIL((" [size = %i] ", list->items[x]->size));
1877 if (list->items[x]->size > 0) { 1877 if (list->items[x]->size > 0) {
1878 if (isprint(list->items[x]->data[0])) { 1878 if (isprint(list->items[x]->data[0]) || (list->items[x]->size < 2)) {
1879 // then there are no control bytes at the front 1879 // then there are no control bytes at the front
1880 item->email->subject->off1 = 0; 1880 item->email->subject->off1 = 0;
1881 item->email->subject->off2 = 0; 1881 item->email->subject->off2 = 0;
1882 item->email->subject->subj = realloc(item->email->subject->subj, list->items[x]->size+1); 1882 item->email->subject->subj = realloc(item->email->subject->subj, list->items[x]->size+1);
1883 memset(item->email->subject->subj, 0, list->items[x]->size+1); 1883 memset(item->email->subject->subj, 0, list->items[x]->size+1);