_sat_decode_ton_npi(src_data[temp_index++], &ss_str_obj->ton, &ss_str_obj->npi);
str_ascii = tcore_util_convert_bcd2ascii((const char *)&src_data[temp_index], ss_len-1, SAT_SS_STRING_LEN_MAX);
if (str_ascii) {
- memcpy(ss_str_obj->ss_string, str_ascii, strlen(str_ascii));
+ snprintf(ss_str_obj->ss_string, strlen(str_ascii) + 1, "%s", str_ascii);
ss_str_obj->string_len = strlen(str_ascii);
g_free(str_ascii);
}
/* address */
if (address) {
- memcpy(other_address_obj->address, address, strlen(address));
+ snprintf(other_address_obj->address, strlen(address) + 1, "%s", address);
other_address_obj->address_len = strlen(address);
g_free(address);
gboolean tcore_util_convert_ipv4_secure_log(gchar *input, gchar *output, int output_len)
{
gchar buf[MAX_BUF_SIZE] = {0,};
- gchar * pch = NULL;
+ gchar *pch = NULL;
int count = 0;
+ char *ptr;
- pch = strtok(input, ".");
- while (pch != NULL)
- {
+ if (!input)
+ return FALSE;
+
+ pch = strtok_r(input, ".", &ptr);
+ while (pch != NULL) {
if (count % 2) {
int i = 0;
int len = strlen(pch);
- for (i = 0; i < len;i++)
+ for (i = 0; i < len; i++)
g_strlcat(buf, "x", MAX_BUF_SIZE);
}
else
g_strlcat(buf, pch, MAX_BUF_SIZE);
- pch = strtok(NULL, ".");
- if(pch)
+
+ pch = strtok_r(NULL, ".", &ptr);
+ if (pch)
g_strlcat(buf, ".", MAX_BUF_SIZE);
count++;
}
gboolean tcore_util_convert_ipv6_secure_log(gchar *input, gchar *output, int output_len)
{
gchar buf[MAX_BUF_SIZE] = {0,};
- gchar * pch = NULL;
+ gchar *pch = NULL;
int count = 0;
+ char *ptr;
- pch = strtok(input, ":");
- while (pch != NULL)
- {
+ if (!input)
+ return FALSE;
+
+ pch = strtok_r(input, ":", &ptr);
+ while (pch != NULL) {
if (count % 2) {
int i = 0;
int len = strlen(pch);
- for (i = 0; i < len;i++)
+ for (i = 0; i < len; i++)
g_strlcat(buf, "x", MAX_BUF_SIZE);
}
else
g_strlcat(buf, pch, MAX_BUF_SIZE);
- pch = strtok(NULL, ":");
- if(pch)
+
+ pch = strtok_r(NULL, ":", &ptr);
+ if (pch)
g_strlcat(buf, ":", MAX_BUF_SIZE);
count++;
}