memset(in_buf, 0x00, ileft + 2);
memset(out_buf, 0x00, oleft + 1);
- memcpy(in_buf, src, ileft);
+ memcpy(in_buf, src, src_len);
in_buf[ileft] = '\0';
int tmp_str_len = 0;
unsigned char *src_buf = NULL;
- src_buf = (unsigned char *)malloc(src_len);
+ src_buf = (unsigned char *)malloc(src_len+1);
if (src_buf == NULL) {
dbg("src_buf malloc failed.");
return FALSE;
}
- memset(src_buf, 0, src_len);
+ memset(src_buf, 0, src_len+1);
memcpy(src_buf, src, src_len);
+ src_buf[src_len] = '\0';
/*
* Get string length
int len = strlen(pch);
for (i = 0; i < len; i++)
g_strlcat(buf, "x", MAX_BUF_SIZE);
- }
- else
+ } else
g_strlcat(buf, pch, MAX_BUF_SIZE);
pch = strtok_r(NULL, ".", &ptr);
int len = strlen(pch);
for (i = 0; i < len; i++)
g_strlcat(buf, "x", MAX_BUF_SIZE);
- }
- else
+ } else
g_strlcat(buf, pch, MAX_BUF_SIZE);
pch = strtok_r(NULL, ":", &ptr);