From: divverent Date: Wed, 26 Nov 2014 12:58:29 +0000 (+0000) Subject: fix a buffer overlap with newer mac osx strlcpy X-Git-Tag: xonotic-v0.8.1~29^2~57 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8f317e4b0e366bff1ba380af77279c3d16d588e9;p=xonotic%2Fdarkplaces.git fix a buffer overlap with newer mac osx strlcpy this fails on strcpy overlap detection in newer Mac OSX releases. 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 0x0000000104a3a29a Mod_LoadTextureFromQ3Shader + 74 (model_shared.c:2446) 8 darkplaces-sdl 0x0000000104a21010 Mod_Q3BSP_Load + 2224 (model_brush.c:5134) 9 darkplaces-sdl 0x0000000104a1e265 Mod_IBSP_Load + 85 (model_brush.c:7956) 10 darkplaces-sdl 0x0000000104a3398b Mod_LoadModel + 1419 (model_shared.c:498) 11 darkplaces-sdl 0x0000000104a37717 Mod_ForName + 55 (model_shared.c:616) 12 darkplaces-sdl 0x0000000104ad3f28 SV_SpawnServer + 424 (sv_main.c:3284) 13 darkplaces-sdl 0x00000001049e497f Host_Map_f + 319 (host_cmd.c:394) 14 darkplaces-sdl 0x00000001049e4bad Host_Changelevel_f + 221 (host_cmd.c:416) 15 darkplaces-sdl 0x000000010494d6f9 Cmd_ExecuteString + 617 (cmd.c:1936) 16 darkplaces-sdl 0x000000010494d14d Cbuf_Execute + 781 (cmd.c:368) 17 darkplaces-sdl 0x000000010494dbd5 Cbuf_Frame + 597 (cmd.c:384) 18 darkplaces-sdl 0x00000001049e0109 Host_Main + 1305 (host.c:781) 19 darkplaces-sdl 0x00000001048c2f06 main + 166 (sys_sdl.c:223) 20 libdyld.dylib 0x00007fff8e7735c9 start + 1 From: nyov git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12103 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/model_brush.c b/model_brush.c index 9f8d70e1..6f2651f6 100644 --- a/model_brush.c +++ b/model_brush.c @@ -5126,10 +5126,9 @@ static void Mod_Q3BSP_LoadTextures(lump_t *l) for (i = 0;i < count;i++) { - strlcpy (out[i].name, in[i].name, sizeof (out[i].name)); out[i].surfaceflags = LittleLong(in[i].surfaceflags); out[i].supercontents = Mod_Q3BSP_SuperContentsFromNativeContents(loadmodel, LittleLong(in[i].contents)); - Mod_LoadTextureFromQ3Shader(out + i, out[i].name, true, true, TEXF_MIPMAP | TEXF_ISWORLD | TEXF_PICMIP | TEXF_COMPRESS); + Mod_LoadTextureFromQ3Shader(out + i, in[i].name, true, true, TEXF_MIPMAP | TEXF_ISWORLD | TEXF_PICMIP | TEXF_COMPRESS); // restore the surfaceflags and supercontents out[i].surfaceflags = LittleLong(in[i].surfaceflags); out[i].supercontents = Mod_Q3BSP_SuperContentsFromNativeContents(loadmodel, LittleLong(in[i].contents));