[openjk] 94/130: Use same mechanism to say "no servers found" as to say how many we found

Simon McVittie smcv at debian.org
Fri Oct 28 11:09:24 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository openjk.

commit dcc12603bd9afa3788ff1559bdc5cdc6ce2e68f4
Author: Simon McVittie <smcv at debian.org>
Date:   Thu Sep 22 08:40:39 2016 +0100

    Use same mechanism to say "no servers found" as to say how many we found
    
    This avoids an array underflow: if no servers were found, we would
    write to foundPlayerServerNames[-1], which is undefined behaviour, but
    with a reasonable assumption of the stack layout is likely to result
    in a write to foundPlayerServerAddresses[MAX - 1].
---
 codemp/ui/ui_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/codemp/ui/ui_main.c b/codemp/ui/ui_main.c
index 862da52..1f17346 100644
--- a/codemp/ui/ui_main.c
+++ b/codemp/ui/ui_main.c
@@ -7830,7 +7830,7 @@ static void UI_BuildFindPlayerList(qboolean force) {
 		// add a line that shows the number of servers found
 		if (!uiInfo.numFoundPlayerServers)
 		{
-			Com_sprintf(uiInfo.foundPlayerServerNames[uiInfo.numFoundPlayerServers-1], sizeof(uiInfo.foundPlayerServerAddresses[0]), "no servers found");
+			trap->Cvar_Set( "ui_playerServersFound", "no servers found" );
 		}
 		else
 		{

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git



More information about the Pkg-games-commits mailing list