Skip to content

Commit

Permalink
Merge pull request xbmc#13355 from Rechi/fix/coverity
Browse files Browse the repository at this point in the history
[fix] coverity issues
  • Loading branch information
Paxxi authored Jan 13, 2018
2 parents acedd16 + 7599d0e commit 9d12303
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions xbmc/cores/DllLoader/dll_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ uintptr_t get_win_function_address(const char* strDllName, const char* strFuncti
auto pGNSI = reinterpret_cast<uintptr_t>(GetProcAddress(handle, strFunctionName));
if(pGNSI != NULL)
return pGNSI;

FreeLibrary(handle);
}
#endif
return 0;
Expand Down
6 changes: 4 additions & 2 deletions xbmc/platform/posix/Filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ std::string create_temp_directory(std::error_code &ec)

auto path = temp_directory_path(ec);

strcpy(buf, (path + "xbmctempXXXXXX").c_str());
strncpy(buf, (path + "xbmctempXXXXXX").c_str(), sizeof(buf) - 1);
buf[sizeof(buf) - 1] = '\0';

auto tmp = mkdtemp(buf);
if (!tmp)
Expand Down Expand Up @@ -115,7 +116,8 @@ std::string temp_file_path(std::string suffix, std::error_code &ec)
return std::string();
}

strcpy(tmp, tempPath.c_str());
strncpy(tmp, tempPath.c_str(), sizeof(tmp) - 1);
tmp[sizeof(tmp) - 1] = '\0';

auto fd = mkstemps(tmp, suffix.length());
if (fd < 0)
Expand Down
2 changes: 2 additions & 0 deletions xbmc/platform/win32/WinMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,14 @@ INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR commandLine, INT)
ShowWindow(hwnd, SW_RESTORE);
SetForegroundWindow(hwnd);
}
ReleaseMutex(appRunningMutex);
return 0;
}

if ((g_cpuInfo.GetCPUFeatures() & CPU_FEATURE_SSE2) == 0)
{
MessageBox(NULL, L"No SSE2 support detected", ToW(appName + ": Fatal Error").c_str(), MB_OK | MB_ICONERROR);
ReleaseMutex(appRunningMutex);
return 0;
}

Expand Down

0 comments on commit 9d12303

Please sign in to comment.