]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fixes some more Mac OS X buffer overlap errors
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 26 Nov 2014 12:58:32 +0000 (12:58 +0000)
committerRudolf Polzer <divVerent@xonotic.org>
Wed, 26 Nov 2014 13:01:38 +0000 (14:01 +0100)
Error report: Mac OS X 10.10 (14A389)

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Application Specific Information:
detected source and destination buffer overlap

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib         0x00007fff91017282 __pthread_kill + 10
1   libsystem_c.dylib              0x00007fff922aab73 abort + 129
2   libsystem_c.dylib              0x00007fff922aacea abort_report_np + 181
3   libsystem_c.dylib              0x00007fff922d0dd0 __chk_fail + 48
4   libsystem_c.dylib              0x00007fff922d0de0 __chk_fail_overlap + 16
5   libsystem_c.dylib              0x00007fff922d0e11 __chk_overlap + 49
6   libsystem_c.dylib              0x00007fff922d0e7e __strlcpy_chk + 68
7   darkplaces-sdl                 0x0000000102903b3e SV_UpdateToReliableMessages + 398 (sv_main.c:2480)
8   darkplaces-sdl                 0x00000001029038bb SV_SendClientMessages + 59 (sv_main.c:2575)
9   darkplaces-sdl                 0x000000010278bb5e Host_Main + 3758 (host.c:910)
10  darkplaces-sdl                 0x00000001025be64f main + 239 (sys_sdl.c:223)
11  libdyld.dylib                  0x00007fff8e7735c9 start + 1

From: nyov <nyov@nexnode.net>

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12104 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=a9a2f5f032331adc43ae3bf99118464157b807ab

sv_main.c

index d17d20a195e0c04bfb87156aa83a6f0855b78de8..bfe2a794a81e34f28b36689542252cb9dd7f5a67 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -2477,7 +2477,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 +2509,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 +2519,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]