diff options
author | Michael Smith <mikesmiffy128@gmail.com> | 2023-04-08 12:18:53 +0100 |
---|---|---|
committer | Michael Smith <mikesmiffy128@gmail.com> | 2023-04-08 12:21:30 +0100 |
commit | e7962fa5ea4e0399bea7d16d08beb29e76c48ff0 (patch) | |
tree | 57babf41da45b28b02de24826553e88814431477 | |
parent | 3e4c26eeb701d96aa73bd482d48140f229cd9079 (diff) |
Fix some miscellaneous stupid bugs and jank
Note: fixes.c was changed this year, so correct the copyright year too.
-rw-r--r-- | src/alias.c | 4 | ||||
-rw-r--r-- | src/demorec.c | 2 | ||||
-rw-r--r-- | src/fixes.c | 2 | ||||
-rw-r--r-- | src/gameinfo.c | 8 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/alias.c b/src/alias.c index b1f7ad7..c281a37 100644 --- a/src/alias.c +++ b/src/alias.c @@ -1,5 +1,5 @@ /* - * Copyright © 2022 Michael Smith <mikesmiffy128@gmail.com> + * Copyright © 2023 Michael Smith <mikesmiffy128@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -76,7 +76,7 @@ static bool find_alias_head(con_cmdcb alias_cb) { // alias command with no args calls ConMsg() then loads the head pointer // that asm looks like: call <reg>; mov <reg>, dword ptr [x] // (we don't care about the exact registers) - if (p[0] == X86_MISCMW && (p[1] & 0xF0) == 0xD0 && + if (p[0] == X86_MISCMW && (p[1] & 0xF8) == 0xD0 && p[2] == X86_MOVRMW && (p[3] & 0xC7) == 0x05) { _alias_head = mem_loadptr(p + 4); return true; diff --git a/src/demorec.c b/src/demorec.c index 307e751..9c836b4 100644 --- a/src/demorec.c +++ b/src/demorec.c @@ -114,7 +114,7 @@ static void hook_record_cb(const struct con_cmdargs *args) { for (const char *p = arg; p - arg < argdirlen; ++p, ++q) { *q = (uchar)*p; } - q[argdirlen] = OS_LIT('\0'); + *q = OS_LIT('\0'); // this is pretty ugly. the error cases would be way tidier if // we could use open(O_DIRECTORY), but that's not a thing on // windows, of course. diff --git a/src/fixes.c b/src/fixes.c index f4a6b4c..7cdc2cb 100644 --- a/src/fixes.c +++ b/src/fixes.c @@ -1,5 +1,5 @@ /* - * Copyright © 2022 Michael Smith <mikesmiffy128@gmail.com> + * Copyright © 2023 Michael Smith <mikesmiffy128@gmail.com> * Copyright © 2022 Hayden K <imaciidz@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any diff --git a/src/gameinfo.c b/src/gameinfo.c index f8b5311..086ab8b 100644 --- a/src/gameinfo.c +++ b/src/gameinfo.c @@ -1,5 +1,5 @@ /* - * Copyright © 2022 Michael Smith <mikesmiffy128@gmail.com> + * Copyright © 2023 Michael Smith <mikesmiffy128@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -271,12 +271,12 @@ bool gameinfo_init(void) { gameinfo_gamedir = GetGameDirectory(engclient); int gamedirlen = strlen(gameinfo_gamedir); #endif - if (gamedirlen + sizeof("/gameinfo.txt") > sizeof(gamedir) / - sizeof(*gamedir)) { + os_char gameinfopath[PATH_MAX]; + if (gamedirlen + sizeof("/gameinfo.txt") > sizeof(gameinfopath) / + sizeof(*gameinfopath)) { errmsg_errorx("game directory path is too long!"); return false; } - os_char gameinfopath[PATH_MAX]; memcpy(gameinfopath, gameinfo_gamedir, gamedirlen * sizeof(*gameinfo_gamedir)); memcpy(gameinfopath + gamedirlen, PATHSEP OS_LIT("gameinfo.txt"), |