Skip to content

Commit

Permalink
Fix gamemode name _modded removal
Browse files Browse the repository at this point in the history
Update license copyright years
  • Loading branch information
danielga committed May 29, 2023
1 parent 62f381d commit 7a3bd40
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion license.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
gmsv_serversecure
A module for Garry's Mod that mitigates exploits on the Source engine.
-----------------------------------------------------------------------
Copyright (c) 2015-2022, Daniel Almeida
Copyright (c) 2015-2023, Daniel Almeida
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
9 changes: 5 additions & 4 deletions source/netfilter/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <random>
#include <stdexcept>
#include <string>
#include <string_view>
#include <unordered_set>
#include <vector>

Expand Down Expand Up @@ -224,11 +225,11 @@ class Core {

if (!gamemode.name.empty()) {
// Check if gamemode name ends with "_modded"
static const std::string suffix = "_modded";
auto gm_name = gamemode.name;
static const std::string_view suffix = "_modded";
std::string_view gm_name = gamemode.name;
if (gm_name.size() > suffix.size() &&
std::equal(gm_name.rbegin(), gm_name.rend(), suffix.rbegin())) {
gm_name = gm_name.substr(0, suffix.size());
gm_name.substr(gm_name.size() - suffix.size()) == suffix) {
gm_name = gm_name.substr(0, gm_name.size() - suffix.size());
}

reply_info.tags.gm = gm_name;
Expand Down

0 comments on commit 7a3bd40

Please sign in to comment.