memset(pThreadInfo->threadName, 0x00, sizeof(pThreadInfo->threadName));
dbHandle->getColumnToString(index++, MAX_THREAD_NAME_LEN, pThreadInfo->threadName);
+ char tmpData[MAX_THREAD_DATA_LEN + 1] = {0};
+ dbHandle->getColumnToString(index++, MAX_THREAD_DATA_LEN, tmpData);
memset(pThreadInfo->threadData, 0x00, sizeof(pThreadInfo->threadData));
- dbHandle->getColumnToString(index++, MAX_THREAD_DATA_LEN, pThreadInfo->threadData);
+ char *end = NULL;
+ if (g_utf8_validate(tmpData, -1, (const gchar **)&end) == true) {
+ g_utf8_strncpy(pThreadInfo->threadData, tmpData, g_utf8_strlen(tmpData, -1));
+ } else {
+ g_utf8_strncpy(pThreadInfo->threadData, tmpData, g_utf8_strlen(tmpData, end - tmpData));
+ }
pThreadInfo->bProtected = (dbHandle->getColumnToInt(index++) > 0) ? true : false;
pThreadInfo->bDraft = dbHandle->getColumnToInt(index++);