localspl: Do not crash when Xcv was opened without a space in the name.
This commit is contained in:
parent
753e61fe11
commit
2253edb7a3
|
@ -520,7 +520,13 @@ DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE pInput
|
||||||
if (!lstrcmpW(pszDataName, cmd_SetDefaultCommConfigW)) {
|
if (!lstrcmpW(pszDataName, cmd_SetDefaultCommConfigW)) {
|
||||||
/* get the portname from the Handle */
|
/* get the portname from the Handle */
|
||||||
ptr = strchrW(((xcv_t *)hXcv)->nameW, ' ');
|
ptr = strchrW(((xcv_t *)hXcv)->nameW, ' ');
|
||||||
|
if (ptr) {
|
||||||
ptr++; /* skip the space */
|
ptr++; /* skip the space */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ptr = ((xcv_t *)hXcv)->nameW;
|
||||||
|
}
|
||||||
lstrcpynW(buffer, ptr, sizeof(buffer)/sizeof(WCHAR));
|
lstrcpynW(buffer, ptr, sizeof(buffer)/sizeof(WCHAR));
|
||||||
if (buffer[0]) buffer[lstrlenW(buffer)-1] = '\0'; /* remove the ':' */
|
if (buffer[0]) buffer[lstrlenW(buffer)-1] = '\0'; /* remove the ':' */
|
||||||
res = SetDefaultCommConfigW(buffer, (LPCOMMCONFIG) pInputData, cbInputData);
|
res = SetDefaultCommConfigW(buffer, (LPCOMMCONFIG) pInputData, cbInputData);
|
||||||
|
|
Loading…
Reference in New Issue