if (stop)
msg = strtok_r(stop + 1, "\\", &save_ptr);
- if (app_id || msg) {
+ if (app_id > 0 && msg) {
if (app_id == 2 && strstr(msg, "READTXPOWER")) {
char cmd_buf[BT_HF_CMD_BUF_SIZE * 2] = {0, };
char power = __bt_hf_agent_get_tx_power(bt_hf_info->remote_addr);
ymd = strtol(timestamp, &ptr, 10);
hms = strtol(ptr + 1, &ptr2, 10);
+ /* Initialize local_time */
+ memset(&local_time, 0, sizeof(struct tm));
+
/* parse year, month, day */
local_time.tm_mday = ymd % 100;
ymd = (ymd - local_time.tm_mday) / 100;
if (body_file != NULL) {
fseek(body_file, 0, SEEK_END);
email_size = ftell(body_file);
+ if (email_size <= 0) {
+ ERR("email_size is not a positive number");
+ g_string_free(msg, TRUE);
+ fclose(body_file);
+ return NULL;
+ }
rewind(body_file);
buf = (char *)g_malloc0(sizeof(char) * email_size);
DBG("MESSAGE: [%s]", buf);
if (read_size != email_size) {
ERR("Unequal Read size");
- email_free_mail_data(&mail_data, 1);
g_string_free(msg, TRUE);
g_free(buf);
return NULL;