crash occured when downloading partial body 38/91538/5 accepted/tizen/common/20161011.154517 accepted/tizen/ivi/20161011.234456 accepted/tizen/mobile/20161011.234500 accepted/tizen/wearable/20161011.234427 submit/tizen/20161011.092348
authorintae, jeon <intae.jeon@samsung.com>
Mon, 10 Oct 2016 06:15:27 +0000 (15:15 +0900)
committerintae jeon <intae.jeon@samsung.com>
Tue, 11 Oct 2016 07:21:00 +0000 (00:21 -0700)
[Problem] crash occured when downloading partial body
[Cause & Measure] Cause:
1. email-service requested UID, BODYSTRUCTURE, BODY to server.
2. UID was comming wrongly as 0. (not reproduced..)
3. email-service iterated its partial body download events to find proper event by comparing UID but it couldn't.
4. the array of partial body download events was out of bound
Measure: Adjusting the bound of index in iteration.

Change-Id: I8fdfe6d827b98f471b56ce6fe7481681cffc3028
Signed-off-by: intae, jeon <intae.jeon@samsung.com>
email-core/email-core-mailbox-sync.c

index 859b2b0..116c083 100755 (executable)
@@ -3961,10 +3961,10 @@ static int emcore_gmime_download_imap_partial_mail_body(MAILSTREAM *stream, int
                if (!(imap_response[i].bodystructure) || imap_response[i].bodystructure_len <= 0) continue;
 
                /* Search the account id of pbd_event */
-               for (temp_count = 0; temp_count <= item_count && pbd_event[temp_count].server_mail_id != imap_response[i].uid_no; temp_count++)
+               for (temp_count = 0; temp_count < item_count && pbd_event[temp_count].server_mail_id != imap_response[i].uid_no; temp_count++)
                        continue;
 
-               if (temp_count > item_count) {
+               if (temp_count > item_count) {
                        EM_DEBUG_EXCEPTION("Can't find proper server_mail_id");
                        goto FINISH_OFF;
                }