Compare commits

...

4 Commits

Author SHA1 Message Date
Jan ab653555f6
Fix plugin with NULL strings causing UB (#695)
Instance string members only after checking for null pointers to prevent UB
2024-05-05 18:00:04 +02:00
GeckoEidechse 9a64c1885c
Add instructions to build with podman (#686)
Add instructions to build NorthstarLauncher with podman under SELinux enabled distros
2024-04-05 19:33:19 +02:00
GeckoEidechse 1004c06706 Trim trailing whitespace in build instructions 2024-04-05 17:01:59 +02:00
Jack d3ee91c1f5
Fix crash in silver-bun (#679) 2024-03-09 00:20:49 +01:00
3 changed files with 27 additions and 7 deletions

View File

@ -40,7 +40,7 @@ Developers who can work a command line may be interested in using [Visual Studio
- Run `cmake . -G "Ninja"` to generate build files.
- Run `cmake --build .` to build the project.
## Linux
### Steps
1. Clone the GitHub repo
@ -49,3 +49,13 @@ Developers who can work a command line may be interested in using [Visual Studio
* `docker build --rm -t northstar-build-fedora .`
* `docker run --rm -it -e CC=cl -e CXX=cl --mount type=bind,source="$(pwd)",destination=/build northstar-build-fedora cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Windows -G "Ninja"`
* `docker run --rm -it -e CC=cl -e CXX=cl --mount type=bind,source="$(pwd)",destination=/build northstar-build-fedora cmake --build .`
#### Podman
When using [`podman`](https://podman.io/) instead of Docker on an SELinux enabled distro, make sure to add the `z` flag when mounting the directory to correctly label it to avoid SELinux denying access.
As such the corresponding commands are
* `podman build --rm -t northstar-build-fedora .`
* `podman run --rm -it -e CC=cl -e CXX=cl --mount type=bind,source="$(pwd)",destination=/build,z northstar-build-fedora cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Windows -G "Ninja"`
* `podman run --rm -it -e CC=cl -e CXX=cl --mount type=bind,source="$(pwd)",destination=/build,z northstar-build-fedora cmake --build .`

View File

@ -69,10 +69,6 @@ Plugin::Plugin(std::string path) : m_location(path)
m_runOnServer = context & PluginContext::DEDICATED;
m_runOnClient = context & PluginContext::CLIENT;
m_name = std::string(name);
m_logName = std::string(logName);
m_dependencyName = std::string(dependencyName);
if (!name)
{
NS::log::PLUGINSYS->error("Could not load name of plugin at '{}'", path);
@ -91,6 +87,10 @@ Plugin::Plugin(std::string path) : m_location(path)
return;
}
m_name = std::string(name);
m_logName = std::string(logName);
m_dependencyName = std::string(dependencyName);
if (!isValidSquirrelIdentifier(m_dependencyName))
{
NS::log::PLUGINSYS->error("Dependency name \"{}\" of plugin {} is not valid", dependencyName, name);

View File

@ -15,11 +15,21 @@
//-----------------------------------------------------------------------------
CModule::CModule(HMODULE hModule)
{
m_pModuleBase = reinterpret_cast<uintptr_t>(hModule);
MODULEINFO mInfo {0};
if (hModule && hModule != INVALID_HANDLE_VALUE)
GetModuleInformation(GetCurrentProcess(), hModule, &mInfo, sizeof(MODULEINFO));
m_nModuleSize = static_cast<size_t>(mInfo.SizeOfImage);
m_pModuleBase = reinterpret_cast<uintptr_t>(mInfo.lpBaseOfDll);
if (!m_nModuleSize || !m_pModuleBase)
return;
CHAR szModuleName[MAX_PATH];
DWORD dwSize = GetModuleFileNameA(hModule, szModuleName, sizeof(szModuleName));
m_ModuleName = strrchr(szModuleName, '\\') + 1;
char* chLast = strrchr(szModuleName, '\\');
m_ModuleName = chLast == nullptr ? szModuleName : chLast + 1;
Init();