Skip to content

Sync with upstream - #7

Merged
Velaron merged 10 commits into
Velaron:androidfrom
Vladislav4KZ:upstream-sync
Jul 27, 2026
Merged

Velaron merged 10 commits into
Velaron:androidfrom
Vladislav4KZ:upstream-sync

Conversation

@Vladislav4KZ

Copy link
Copy Markdown

No description provided.

s1lentq and others added 10 commits July 9, 2026 07:28
…bled (rehlds#1162)

When hostage_ai_enable is set in CS 1.6 but bots are not allowed
(dedicated server without bot_enable), CCSBotManager::LoadNavigationMap
returns early and never frees the navigation mesh of the previous map.
LoadNavigationMap() then sees a non-empty TheNavAreaList and keeps the
stale nav data, so on the next hostage map CHostageImprov is created
against the wrong navigation mesh: hostages freeze and stop responding
to +use.

Destroy the stale navigation data in CHostageManager::ServerActivate
before loading, but only when bots are not allowed - otherwise
CCSBotManager has already reloaded the nav mesh earlier in the same
ServerActivate and holds pointers into it.

Fixes rehlds#1161

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* Fix global buffer overflow in SharedParse()

SharedParse() copies each parsed token into the fixed-size global buffer
s_shared_token[1500] without any bounds checking. A single token (a quoted
string or an unquoted word) longer than 1499 bytes overflows the buffer and
corrupts adjacent globals, which can crash the server or corrupt state.

The buffer is fed from data files parsed via LOAD_FILE_FOR_ME (botprofile.db,
BotChatter.db, mapcycle.txt, tutor messages) and from the default-weapon
cvars, so a malformed or malicious file/config triggers the overflow.

Bound all three write sites to sizeof(s_shared_token) - 1, matching the
existing pattern already used in CBasePlayer::ParseAutoBuyString(). Well-formed
input is unaffected; only pathologically long tokens are now truncated.

Add unit tests covering oversized unquoted/quoted tokens and normal token
parsing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Fix CHECK macro usage in SharedParse unit tests

cppunitlite CHECK takes (message, condition); single-argument form
broke the Tests build on CI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Fix global buffer overflow in PrioritizeAutoBuyString()

priorityToken[32] is filled from the client-supplied autobuy string
(m_autoBuyString) without any bounds checking. A single autobuy token
longer than 31 characters overflows the buffer and corrupts adjacent
stack state during career-mode auto-buy.

Bound the token copy to sizeof(priorityToken) - 1, matching the pattern
in ParseAutoBuyString(), and skip the rest of an oversized token so it
is not re-split into a spurious priority token on the next iteration.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…eams are full (rehlds#1168)

* Prevent mp_forcerespawn from spawning players without a team

PlayerRespawnThink only applied the UNASSIGNED/SPECTATOR check to
observers, so a non-observer player stuck at the team select menu
(both teams full) with mp_forcerespawn > 0 and mp_auto_join_team 1
got a pending respawn and spawned while on TEAM_UNASSIGNED.

Fixes rehlds#929

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Deny auto-team-select when both teams are full

HandleMenu_ChooseTeam with MENU_SLOT_TEAM_RANDOM fell through with
team == UNASSIGNED when SelectDefaultTeam() found both teams full and
no bot could be vacated: TeamFull(UNASSIGNED) and TeamStacked() pass,
so the player joined UNASSIGNED and got into the game, spawning via
GetIntoGame() since FPlayerCanRespawn() always passes with
mp_forcerespawn > 0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…#1167)

When improved hostage AI (hostage_ai_enable 1) is used in CS 1.6,
hostages panic and scatter in response to gunfire, explosions and
nearby deaths. Setting mp_hostage_fear 0 keeps them calm, restoring
1.6-like hostage behavior while retaining the rest of the improved AI.

Related to rehlds#1125

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…er (rehlds#1164)

* Add mp_show_bomb_timer cvar: show C4 countdown on the HUD round timer

When enabled, the HUD round timer shows the time remaining until the
planted C4 explodes instead of hiding after the bomb plant, and is
restored back to the round time after a successful defuse.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Restore the HUD round timer after the bomb explodes

With mp_show_bomb_timer enabled the round timer shows the C4 countdown
after a plant. If the bomb round-end check is blocked (mp_round_infinite
flag e), the explosion does not end the round and the HUD timer stays
frozen at 0:00 until the next resync event.

Resync the timer for all players in CGrenade::Explode2 so it falls back
to the real round time once the bomb has blown, mirroring the resync
already done on defuse.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Regression from rehlds#1045: replacing the hardcoded pistol allow-list with
!IsSecondaryWeapon(m_iId) dropped the explicit knife exception. Since the
knife is not a secondary weapon, DefaultTouch rejected it for a VIP, so
GiveDefaultItems() (which routes weapon_knife through DispatchTouch) left
the VIP without a knife while the pistol was still given.

Restore the knife exception in the REGAMEDLL_FIXES branch.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
…1170)

Drowning damage is tracked in m_idrowndmg and "given back" as health via
DMG_DROWNRECOVER once the player takes a breath. The tracker must only ever
hold damage that was actually applied.

The existing REGAMEDLL_FIXES guard checked the DMG_DROWN bit in
m_bitsDamageType, but CBasePlayer::TakeDamage sets that bit unconditionally
at the end, even when CBaseMonster::TakeDamage refused the damage because
pev->takedamage == DAMAGE_NO. So an invulnerable player still accumulated
m_idrowndmg while drowning, and on surfacing that phantom damage was
restored as free health (up to max_health).

Gate the tracking on the actual return value of TakeDamage instead: it is
FALSE both when damage is refused (DAMAGE_NO) and when the tick was lethal
(and possibly followed by respawn), which is exactly when we must not track.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@Velaron
Velaron merged commit f386907 into Velaron:android Jul 27, 2026
4 checks passed
@Vladislav4KZ
Vladislav4KZ deleted the upstream-sync branch July 27, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants