mirror of
https://github.com/sharkcz/rkdeveloptool.git
synced 2024-11-22 14:06:47 +01:00
Fixed Build Failed - gcc 8.2.0
ERROR: main.cpp:2841:10: error: ‘char* strncpy(char*, const char*, size_t)’ output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] Since the allocation is only 100*char, the reasonable fix would be limit the strncpy to only (100-1)*char.
This commit is contained in:
parent
72c04fec88
commit
c43947cfb1
2
main.cpp
2
main.cpp
@ -2838,7 +2838,7 @@ void split_item(STRING_VECTOR &vecItems, char *pszItems)
|
|||||||
}
|
}
|
||||||
if (strlen(pStart) > 0) {
|
if (strlen(pStart) > 0) {
|
||||||
memset(szItem, 0, 100);
|
memset(szItem, 0, 100);
|
||||||
strncpy(szItem, pStart, strlen(pStart));
|
strncpy(szItem, pStart, 100-1);
|
||||||
strItem = szItem;
|
strItem = szItem;
|
||||||
vecItems.push_back(strItem);
|
vecItems.push_back(strItem);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user