diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c index 23c3afdc..5c747bd8 100644 --- a/code/game/g_cmds.c +++ b/code/game/g_cmds.c @@ -76,7 +76,7 @@ void DeathmatchScoreboardMessage( gentity_t *ent ) { perfect, cl->ps.persistant[PERS_CAPTURES]); j = strlen(entry); - if (stringlength + j > 1024) + if (stringlength + j >= sizeof(string)) break; strcpy (string + stringlength, entry); stringlength += j; diff --git a/code/game/g_team.c b/code/game/g_team.c index 58d79d96..9abfdc29 100644 --- a/code/game/g_team.c +++ b/code/game/g_team.c @@ -1112,7 +1112,7 @@ void TeamplayInfoMessage( gentity_t *ent ) { i, player->client->pers.teamState.location, h, a, player->client->ps.weapon, player->s.powerups); j = strlen(entry); - if (stringlength + j > sizeof(string)) + if (stringlength + j >= sizeof(string)) break; strcpy (string + stringlength, entry); stringlength += j; diff --git a/code/qcommon/vm_x86.c b/code/qcommon/vm_x86.c index ba590635..32a5a9a7 100644 --- a/code/qcommon/vm_x86.c +++ b/code/qcommon/vm_x86.c @@ -53,7 +53,7 @@ static void VM_Destroy_Compiled(vm_t* self); */ -#define VMFREE_BUFFERS() {Z_Free(buf); Z_Free(jused);} +#define VMFREE_BUFFERS() do {Z_Free(buf); Z_Free(jused);} while(0) static byte *buf = NULL; static byte *jused = NULL; static int compiledOfs = 0; diff --git a/code/qcommon/vm_x86_64.c b/code/qcommon/vm_x86_64.c index 4c824c1b..789416cb 100644 --- a/code/qcommon/vm_x86_64.c +++ b/code/qcommon/vm_x86_64.c @@ -54,7 +54,7 @@ static FILE* qdasmout; #define Dfprintf(args...) #endif -#define VM_FREEBUFFERS(vm) {assembler_init(0); VM_Destroy_Compiled(vm);} +#define VM_FREEBUFFERS(vm) do {assembler_init(0); VM_Destroy_Compiled(vm);} while(0) void assembler_set_output(char* buf); size_t assembler_get_code_size(void);