]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_main.c
Fix NULL crash in QW_CL_RequestNextDownload without connection.
[xonotic/darkplaces.git] / sv_main.c
index d17d20a195e0c04bfb87156aa83a6f0855b78de8..a5eed884bdade7f6e4a780a0ee991877a44f5781 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -933,7 +933,7 @@ void SV_SendServerinfo (client_t *client)
        MSG_WriteString (&client->netconnection->message,message);
 
        SV_StopDemoRecording(client); // to split up demos into different files
-       if(sv_autodemo_perclient.integer && client->netconnection)
+       if(sv_autodemo_perclient.integer)
        {
                char demofile[MAX_OSPATH];
                char ipaddress[MAX_QPATH];
@@ -1085,12 +1085,14 @@ void SV_ConnectClient (int clientnum, netconn_t *netconnection)
 
        if(client->netconnection && client->netconnection->crypto.authenticated)
        {
-               Con_Printf("%s connection to %s has been established: client is %s@%.*s, I am %.*s@%.*s\n",
+               Con_Printf("%s connection to %s has been established: client is %s@%s%.*s, I am %.*s@%s%.*s\n",
                                client->netconnection->crypto.use_aes ? "Encrypted" : "Authenticated",
                                client->netconnection->address,
                                client->netconnection->crypto.client_idfp[0] ? client->netconnection->crypto.client_idfp : "-",
+                               (client->netconnection->crypto.client_issigned || !client->netconnection->crypto.client_keyfp[0]) ? "" : "~",
                                crypto_keyfp_recommended_length, client->netconnection->crypto.client_keyfp[0] ? client->netconnection->crypto.client_keyfp : "-",
                                crypto_keyfp_recommended_length, client->netconnection->crypto.server_idfp[0] ? client->netconnection->crypto.server_idfp : "-",
+                               (client->netconnection->crypto.server_issigned || !client->netconnection->crypto.server_keyfp[0]) ? "" : "~",
                                crypto_keyfp_recommended_length, client->netconnection->crypto.server_keyfp[0] ? client->netconnection->crypto.server_keyfp : "-"
                                );
        }
@@ -2477,7 +2479,9 @@ static void SV_UpdateToReliableMessages (void)
                if (name == NULL)
                        name = "";
                // always point the string back at host_client->name to keep it safe
-               strlcpy (host_client->name, name, sizeof (host_client->name));
+               //strlcpy (host_client->name, name, sizeof (host_client->name));
+               if (name != host_client->name) // prevent buffer overlap SIGABRT on Mac OSX
+                       strlcpy (host_client->name, name, sizeof (host_client->name));
                PRVM_serveredictstring(host_client->edict, netname) = PRVM_SetEngineString(prog, host_client->name);
                if (strcmp(host_client->old_name, host_client->name))
                {
@@ -2507,7 +2511,9 @@ static void SV_UpdateToReliableMessages (void)
                if (model == NULL)
                        model = "";
                // always point the string back at host_client->name to keep it safe
-               strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel));
+               //strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel));
+               if (model != host_client->playermodel) // prevent buffer overlap SIGABRT on Mac OSX
+                       strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel));
                PRVM_serveredictstring(host_client->edict, playermodel) = PRVM_SetEngineString(prog, host_client->playermodel);
 
                // NEXUIZ_PLAYERSKIN
@@ -2515,7 +2521,9 @@ static void SV_UpdateToReliableMessages (void)
                if (skin == NULL)
                        skin = "";
                // always point the string back at host_client->name to keep it safe
-               strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin));
+               //strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin));
+               if (skin != host_client->playerskin) // prevent buffer overlap SIGABRT on Mac OSX
+                       strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin));
                PRVM_serveredictstring(host_client->edict, playerskin) = PRVM_SetEngineString(prog, host_client->playerskin);
 
                // TODO: add an extension name for this [1/17/2008 Black]
@@ -3593,6 +3601,7 @@ static void SVVM_init_edict(prvm_prog_t *prog, prvm_edict_t *e)
                        PRVM_serveredictstring(e, crypto_idfp) = PRVM_SetEngineString(prog, svs.clients[num].netconnection->crypto.client_idfp);
                else
                        PRVM_serveredictstring(e, crypto_idfp) = 0;
+               PRVM_serveredictfloat(e, crypto_idfp_signed) = (svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated && svs.clients[num].netconnection->crypto.client_issigned);
                if(svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated && svs.clients[num].netconnection->crypto.client_keyfp[0])
                        PRVM_serveredictstring(e, crypto_keyfp) = PRVM_SetEngineString(prog, svs.clients[num].netconnection->crypto.client_keyfp);
                else