fix endsWith bug

This commit is contained in:
mrbesen 2023-02-26 12:32:59 +01:00
parent e67c18f2ce
commit 5f3ff9e292
Signed by untrusted user: MrBesen
GPG Key ID: 596B2350DCD67504
1 changed files with 2 additions and 2 deletions

View File

@ -24,7 +24,7 @@ static const std::string CLIENTNAME = "LeagueClientUx.exe"; // returns the name
static std::shared_ptr<ClientAccess> findUsingLockfile(const std::vector<std::string>& cmdline, pid_t pid);
static bool endsWith(const std::string& all, const std::string& end) {
return all.rfind(end) == all.size() - end.size();
return all.size() >= end.size() && all.rfind(end) == all.size() - end.size();
}
// reads a procfile into a vector (strings are \0 seperated)
@ -71,7 +71,7 @@ std::shared_ptr<ClientAccess> ClientAccess::find() {
std::string& exename = args.at(0);
if(endsWith(exename, CLIENTNAME)) {
Log::info << CLIENTNAME << " found";
Log::info << CLIENTNAME << " found: " << exename;
std::shared_ptr<ClientAccess> out;