libcom/osi: fix dangerous usage of strncat (WIN32)

(found by sonar/cppcheck)
This commit is contained in:
Ralph Lange
2020-06-09 13:12:03 +02:00
parent d5eb055bb7
commit d3d40689c8

View File

@@ -64,10 +64,10 @@ epicsShareFunc int epicsShareAPI osiSockAttach()
DWORD titleLength = GetConsoleTitle(title, sizeof(title));
if (titleLength) {
titleLength = strlen (title);
strncat (title, " " EPICS_VERSION_STRING, sizeof(title));
strncat (title, " " EPICS_VERSION_STRING, sizeof(title)-1);
}
else {
strncpy(title, EPICS_VERSION_STRING, sizeof(title));
strncpy(title, EPICS_VERSION_STRING, sizeof(title)-1);
}
title[sizeof(title)-1]= '\0';
SetConsoleTitle(title);