File rkdeveloptool_build.diff of Package rkdeveloptool

diff --git a/main.cpp b/main.cpp
index f09e181..d63c302 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1728,10 +1728,10 @@ end:
 static inline void wide2str(const uint16_t* wide, char* str, int len)
 {
 	int i;
-	for (i = 0; i < len; i++) {
+	for (i = 0; i < len - 1; i++) {
 		str[i] = (char) (wide[i] & 0xFF);
 	}
-	str[len] = 0;
+	str[len - 1] = 0;
 }
 
 static bool unpackEntry(rk_boot_entry* entry, const char* name,
@@ -2828,7 +2828,7 @@ void split_item(STRING_VECTOR &vecItems, char *pszItems)
 	pos = strchr(pStart, ',');
 	while(pos != NULL) {
 		memset(szItem, 0, 100);
-		strncpy(szItem, pStart, pos - pStart);
+		strncpy(szItem, pStart, std::min<uintptr_t>(pos - pStart, 99));
 		strItem = szItem;
 		vecItems.push_back(strItem);
 		pStart = pos + 1;
@@ -2838,7 +2838,7 @@ void split_item(STRING_VECTOR &vecItems, char *pszItems)
 	}
 	if (strlen(pStart) > 0) {
 		memset(szItem, 0, 100);
-		strncpy(szItem, pStart, strlen(pStart));
+		strncpy(szItem, pStart, sizeof(szItem) - 1);
 		strItem = szItem;
 		vecItems.push_back(strItem);
 	}