BT_DBG("");
char *ifname = NULL;
char *address = NULL;
- char *ip6;
+ char *ip6 = NULL;
gchar *network_ipv6_address = NULL;
char *remote_ipv6_address = NULL;
if (ret != BT_ERROR_NONE)
BT_DBG("failed to set ipv6 address");
+ g_free(ip6);
+
ret = __bt_ipsp_create_ipv6_remote_address(address, &remote_ipv6_address);
if (ret != BT_ERROR_NONE)
BT_DBG("failed to create remote device ipv6 address");
__bt_ipsp_get_network_interface_name(&network_interface);
+
+ if (network_interface)
__bt_ipsp_get_network_ipv6_address(network_interface, MOBILE_AP_IPV6_SCOPE_GLOBAL, &network_ipv6_address);
/* Add the Routing Rule */
__bt_ipsp_add_ipv6_route(network_interface, network_ipv6_address, 64);
g_free(network_ipv6_address);
-
+ g_free(remote_ipv6_address);
+ g_free(network_interface);
}
BT_DBG("-");
int month;
time_t int_time;
- sscanf(timestamp, "%04d%02d%02dT%02d%02d%02d", &year, &month,
- &local_time.tm_mday, &local_time.tm_hour,
- &local_time.tm_min, &local_time.tm_sec);
+ int ymd; /* year, month, day */
+ int hms; /* hour, min, sec */
+ char *ptr, *ptr2;
+
+ 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;
+ month = ymd % 100;
+ year = (ymd - month) / 100;
+
+ /* parse hour, minute, sec */
+ local_time.tm_sec = hms % 100;
+ hms = (hms - local_time.tm_sec) / 100;
+ local_time.tm_min = hms % 100;
+ local_time.tm_hour = (hms - local_time.tm_min) / 100;
local_time.tm_year = year - 1900;
local_time.tm_mon = month - 1;
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);
+ 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);
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;