Fix the prevent issue
[platform/core/connectivity/bluetooth-agent.git] / map-agent / bluetooth_map_email.c
index 0709816..745a93a 100644 (file)
@@ -752,7 +752,7 @@ static char *__bt_prepare_email_bmseg(email_mail_data_t *mail_data)
                }
                rewind(body_file);
 
-               buf = (char *)g_malloc0(sizeof(char) * email_size);
+               buf = (char *)g_malloc0(sizeof(char) * (email_size + 1));
                read_size = fread(buf, 1, email_size, body_file);
                fclose(body_file);
                DBG("MESSAGE: [%s]", buf);