Commit graph

158 commits

Author SHA1 Message Date
Thomas Köppe
3f29b8558d [qcommon] Make several zone variables and functions static. 2018-02-07 09:13:27 -06:00
Zack Middleton
738465d677 Revert my recent cvar latch changes
My cvar latch system changes prevent the Game VM from changing
g_gametype when the value is out of range due to it being registed in
the engine. It's been pointed out as fragile method of security, which
was still exploitable, by Noah Metzger (Chomenor). It doesn't seem like
this is working out to be a good solution.

The issue of fs_game '..' on server being relicated on client via
systeminfo exploit is still fixed as it's not affected by latch.
There are a few cases from current values of fs_game are used which
ideally should use fs_gamedir char array which has been validated.

Revert "Don't let VMs change engine latch cvars immediately"
Partially revert "Fix fs_game '..' reading outside of home and base path"
Revert "Fix VMs forcing engine latch cvar to update to latched value"
2018-01-21 22:45:46 -06:00
Zack Middleton
3638f69dff Fix fs_game '..' reading outside of home and base path
VMs could set fs_game to '..' at anytime to access files outside of home
and base path. fs_game sent by server to clients could also be '..' to
access files outside of home and base path.

'..' was not caught by FS_CheckDirTraversal() as it expects filenames
not a single directory.

I've made fs_game be latched to prevent VMs from changing it with no
good way to validate it before it's used. com_basegame and fs_basegame
are now latched as well.

Additionally, it's now possible to change com_basegame while the engine
is running. game_restart or vid_restart will make it take affect.
com_homepath is now CVAR_PROTECTED to prevent VMs from changing it
to a directory traversal.

This requires my two previous commits for preventing VMs from changing
engine latch cvars and only Cvar_Get fs_game in FS_Startup (so CVAR_INIT
isn't added in serveral other places).

Reported by Noah Metzger (Chomenor).
2018-01-21 06:02:28 -06:00
Zack Middleton
adef4e6c9e Don't register fs_game cvar everywhere just to get the value 2018-01-21 06:02:08 -06:00
Edward Betts
fe42b8653d Correct spelling mistakes. 2017-11-22 01:40:20 -06:00
Thomas Köppe
b3223dcfcb [qcommon] Use unsigned types where wrapping arithmetic is intended
The use of signed types in these expressions lead to overflow, hence undefined behaviour. The "sum" aggregator in Com_TouchMemory isn't even used (and presumbably just exists to inhibit optimizations from removing the memory access).
2017-10-02 19:46:37 -05:00
Zack Middleton
ead54782d0 Improve client input responsiveness
Move sampling input to the other side of framerate limiter.

Thanks to Alexander "wareya" Nadeau and Juraj "youurayy" Vitko for
pointing this out.
2017-08-21 21:40:54 -05:00
Zack Middleton
be1c71d363 Combine mouse movement events in event queue
Fixes 'Com_QueueEvent: overflow' spam after hitch / map load.

Based on patch by @ec-.
2017-08-21 20:12:26 -05:00
Zack Middleton
dfce71929a Add con_autochat and con_autoclear cvars 2017-06-08 15:46:19 -05:00
Zack Middleton
66365a3a85 Merge pull request #198 from UniQP/deadvariable
Remove dead variables
2017-05-24 13:40:53 -05:00
SmileTheory
de3339ebcd Fill in filename in Com_WriteConfig_f() before checking extension.
Thanks BartoCH for pointing out.
2017-03-27 04:11:33 -07:00
SmileTheory
b173ac0599 Merge some file writing extension checks from OpenJK.
Thanks Ensiform.
https://github.com/JACoders/OpenJK/commit/05928a57f9e4aae15a3bd0
https://github.com/JACoders/OpenJK/commit/ef124fd0fc48af164581176
2017-03-13 20:44:47 -07:00
Zack Middleton
313064baa4 Fix command line variables not being set correctly
+seta, +sets, and +setu were ignored because Com_AddStartupCommands
thought Com_StartupVariable handled it.

+set didn't allow value to be multiple tokens which due to Unix shell
unintuitively removing quotes causes the variable to only be set to
the first token. This could be worked around by escaping quotes

    ioq3ded +set g_motd \"hello world\"

but it doesn't match behavior of other start up commands (which now
includes seta, sets, and setu) that use all tokens.
2017-02-22 15:16:50 -06:00
Zachary J. Slater
7efe1c97a7 Merge pull request #99 from openmoh/ioq3-SSE-msg
rephrase SSE availability message (thanks)
2017-01-24 19:28:41 -10:00
Zack Middleton
c80f341711 Handle ERR_DROP during Com_GameRestart
If ERR_DROP during Com_GameRestart after shutting down client, Com_Error
needs to restart the client otherwise there is just a black window. Also,
clear the game restarting flag in Com_Error otherwise it's not possible to
run Com_GameRestart again later.

I don't know of a way to trigger ERR_DROP, in FS_Restart for instance,
without engine changes however.
2016-10-09 19:17:58 -05:00
Zack Middleton
755b2f38f0 Offer post-crash safe settings on a per-mod basis
Offer to restore settings when loading a mod that crashed, not the first
mod that gets loaded after a crash. Before the first mod loaded (usually
baseq3) would get the option even if missionpack or some other mod crashed.

- Make pid files separate for each fs_game.
- Remove/write pid every time switching fs_game.
- Create path before writing pid file otherwise it fails on first run.
- Show mod description.txt or fs_game instead of engine name in abnormal
  exit message.
- Check com_fullyInitialized in Com_Error before removing PID,
  otherwise "ioquake3 --version" segfaults when accessing fs_gamevar->string
  (plus not fully initialized isn't really a normal shutdown).
2016-10-09 18:18:08 -05:00
Tim Angus
cce24668f7 Merge pull request #225 from smcv/reproducible-date
Pick up date from SOURCE_DATE_EPOCH, for reproducible builds
2016-09-27 21:05:24 +01:00
Simon McVittie
9c76b546e3 Pick up date from SOURCE_DATE_EPOCH, for reproducible builds
The goal of reproducible builds is that a rebuild of the same source
code with the same compiler, libraries, etc. should result in the same
binaries. SOURCE_DATE_EPOCH provides a standard way for build systems
to fill in the date of the latest source change, typically from a git
commit or from metadata like the debian/changelog in Debian packages.

This does not change anything if SOURCE_DATE_EPOCH is not defined;
the intention is that a larger build system like a Debian package
will define it.

Please see https://reproducible-builds.org/ for more information about
reproducible builds.
2016-09-22 09:02:20 +01:00
Simon McVittie
7d4f9525df Fix mis-spellings of "separating" as "seperating"
Found by Debian's Lintian tool.
2016-09-22 08:56:30 +01:00
Sebastian Buchwald
8c6d43e6be Remove dead variables 2016-07-26 14:42:22 +02:00
Thilo Schulz
9d6a95d4ad Missed this Cvar_Get() on com_introPlayed 2016-06-16 03:29:26 +02:00
Thilo Schulz
bb7ad55382 Only play logo/intro if their filenames have been defined in q_shared.h 2016-06-16 03:01:21 +02:00
Zack Middleton
8b458e5457 Fix warnings that names passed to Name_PlayerNameCompletion is not const 2016-05-09 10:41:58 -05:00
Zachary J. Slater
fe619680f8 Merge pull request #73 from Pan7/sayto
sayto cmd with player name completion
2015-12-28 09:04:19 -08:00
Zachary J. Slater
5555788867 Merge pull request #103 from openmoh/ioq3-intro
Have custom intro cinematics for standalone game
2015-12-28 08:56:20 -08:00
/dev/humancontroller
c4a2836269 Fix Com_RandomBytes weak-random case
255 is valid for unsigned char too.
2015-03-20 18:50:58 -05:00
Michael Rieder
7c5feef6a2 Have custom intro cinematics for standalone game 2015-01-07 23:47:18 +01:00
Michael Rieder
dd3c6619bc rephrase SSE availability message 2015-01-02 02:31:10 +01:00
Tim Angus
f83334d81b Add facility to describe cvars 2014-09-26 14:29:51 +01:00
Tim Angus
43b21055b8 Actually, that's not suppressing, that's changing behaviour 2014-09-01 13:07:08 +01:00
Tim Angus
eeaf0227f7 Suppress warning of (deliberate) null pointer deference 2014-09-01 11:19:57 +01:00
Pan7
f62d4c7f1c sayto cmd with player name completion 2014-07-18 00:15:05 +02:00
Tequila
baca82d64e Bunch of comment fixes 2014-03-13 02:20:54 +01:00
/dev/humancontroller
9e9d6fa52c clean up return statements a bit more 2013-05-30 15:43:21 -05:00
/dev/humancontroller
9d626b6a12 drop some useless return statements 2013-05-30 15:43:21 -05:00
/dev/humancontroller
830d93aa38 add some noreturn annotations 2013-05-30 15:39:22 -05:00
Tim Angus
98360bcd57 Fix some of the things clang --analyze flagged 2013-03-26 16:50:03 +00:00
Zachary Slater
20a77764dd Increase various arbitrary limits - Bug #5463 2013-01-06 01:36:39 -08:00
Zack Middleton
2fbf9d9006 Removed unused functoin Hunk_Trash. 2011-12-08 22:54:45 +00:00
Zack Middleton
7b2f842053 Show file/line/label in Com_Error messages when run out of memory in debug build. 2011-12-08 22:25:25 +00:00
Tim Angus
fd986dae06 * Fix various warnings with GCC and clang 2011-10-27 21:32:28 +00:00
Tim Angus
675e7a641a * clang support 2011-10-21 22:48:53 +00:00
Zack Middleton
5d24905c8d Simulate line buffering and fix the overflow bug in Com_ReadFromPipe(), patch from DevHC. 2011-08-05 21:45:22 +00:00
Thilo Schulz
8ab91bde8e - Fix already defined command warnings for minimize
- Fix recursive CL_Shutdown warning and "command already defined" warnings when quitting while playing on a server that changed the gamedir.
2011-08-01 10:16:40 +00:00
Thilo Schulz
40dfcee06e Modular rendering system. Patch by use.less01
This might break MSVC builds. I'll take care of it later
2011-08-01 01:19:55 +00:00
Thilo Schulz
ba385fa43c - Switch master server protocol to dpmaster for better game separation. Based partly on patch by Zack Middleton
- Get rid of ugly cvars sv_heartbeat and cl_gamename and replace with single com_gamename
- Remove sv_flatline. Flatlines are ignored by dpmaster and are considered to be insecure because flatlines can be udp-spoofed.
2011-07-29 13:46:50 +00:00
Thilo Schulz
23f6fd1633 Bug 5094 - Code cleanup, patch by Zack Middleton and DevHC. Fixes unused-but-set gcc warnings 2011-07-29 12:27:00 +00:00
Thilo Schulz
2349148cf1 - Apply parts of Ben Millwood's target bitfield patch (#3787)
- Fix Ryan's FIXME and have voip packet buffer on the server dynamically allocated via Z_Malloc and store pointers in a circular buffer
- Improve voip target parsing on top of Ben Millwood's patch
- Add new "spatial" target where speaker is spatialized in 3d space and can be heard by all clients in hearing range (s_alMaxDistance)
  (#4467)
- Decrease voip sound lengths from 240ms to 80ms per voip packet to mitigate udp packet loss and decrease latency
- Protocol version incremented to 71
2011-07-27 15:47:29 +00:00
Thilo Schulz
9dc32d55e2 Bug 4812 - GCC __attribute__ annotations for printf, non-returning functions etc., patch by linux@youmustbejoking.demon.co.uk and Zack Middleton 2011-07-18 14:56:57 +00:00
Thilo Schulz
e6ba500164 Move rate limiting / queued packet sending logic from Com_Frame() to sv_main.c 2011-07-15 16:51:54 +00:00