diff options
| author | 2023-01-15 22:28:45 +0000 | |
|---|---|---|
| committer | 2023-01-15 22:28:45 +0000 | |
| commit | 769f9c0c340635cf401bdc92cb9a4c515ffeb0f3 (patch) | |
| tree | e4bfe0849a5f47acdc1fce4b685209696641e48a /src | |
| parent | Fix cloaking users with a non-IP hostname when using hmac-sha256-ip. (diff) | |
Fix some issues reported by scan-build.
All of these are harmless and should never cause an issue in practise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/modules.cpp | 20 | ||||
| -rw-r--r-- | src/modules/m_blockamsg.cpp | 3 | ||||
| -rw-r--r-- | src/modules/m_cloak.cpp | 2 | ||||
| -rw-r--r-- | src/modules/m_dccallow.cpp | 7 | ||||
| -rw-r--r-- | src/modules/m_silence.cpp | 7 |
5 files changed, 31 insertions, 8 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index d6fff30c2..c391850f5 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -279,21 +279,27 @@ found_src: // The modules registered for a hook are called in reverse order (to allow for easier removal // of list entries while looping), meaning that the Priority given to us has the exact opposite effect // on the list, e.g.: PRIORITY_BEFORE will actually put 'mod' after 'which', etc. - size_t swap_pos = my_pos; + size_t swap_pos; switch (s) { case PRIORITY_LAST: + { if (prioritizationState != PRIO_STATE_FIRST) return true; - else - swap_pos = 0; + + swap_pos = 0; break; + } + case PRIORITY_FIRST: + { if (prioritizationState != PRIO_STATE_FIRST) return true; - else - swap_pos = EventHandlers[i].size() - 1; + + swap_pos = EventHandlers[i].size() - 1; break; + } + case PRIORITY_BEFORE: { /* Find the latest possible position, only searching AFTER our position */ @@ -308,6 +314,7 @@ found_src: // didn't find it - either not loaded or we're already after return true; } + /* Place this module before a set of other modules */ case PRIORITY_AFTER: { @@ -322,6 +329,9 @@ found_src: // didn't find it - either not loaded or we're already before return true; } + + default: + return true; // Should never happen. } swap_now: diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 3a69a4724..f3cbfd37a 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -143,8 +143,7 @@ public: } else { - m = new BlockedMessage(parameters[1], parameters[0], ServerInstance->Time()); - blockamsg.Set(user, m); + blockamsg.SetFwd(user, parameters[1], parameters[0], ServerInstance->Time()); } } return MOD_RES_PASSTHRU; diff --git a/src/modules/m_cloak.cpp b/src/modules/m_cloak.cpp index 69907498d..50bb95ec4 100644 --- a/src/modules/m_cloak.cpp +++ b/src/modules/m_cloak.cpp @@ -138,7 +138,7 @@ public: cloaks->push_back(cloak); ServerInstance->Logs.Debug(MODNAME, "Cloaked %s (%s/%s) as %s using the %s method.", - user->uuid.c_str(), user->GetIPString().c_str(), user->GetRealHost().c_str(), + user->uuid.c_str(), user->GetIPString().c_str(), user->GetRealHost().c_str(), cloak.c_str(), cloakmethod->GetName()); } ext.Set(user, cloaks); diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index bb0a6d2e2..67e28c93b 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -160,6 +160,13 @@ public: list->push_back(dccallow); } + // If we have an empty list then don't store it. + if (list->empty()) + { + delete list; + return; + } + // The value was well formed. Set(user, list); } diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index dd2f764b5..3d53f00e3 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -247,6 +247,13 @@ public: list->emplace(flags, mask); } + // If we have an empty list then don't store it. + if (list->empty()) + { + delete list; + return; + } + // The value was well formed. Set(user, list); } |
