]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - prvm_edict.c
PRVM: Fix a hack in LNO file loading
[xonotic/darkplaces.git] / prvm_edict.c
index c05aaa28559b6786be56f8614c15fe970ddcb488..323f40a25583574fc421c409edc74653609d0752 100644 (file)
@@ -1973,12 +1973,12 @@ static void PRVM_LoadLNO( prvm_prog_t *prog, const char *progname ) {
        }
 
        header = (unsigned int *) lno;
-       if( header[ 0 ] == *(unsigned int *) "LNOF" &&
-               LittleLong( header[ 1 ] ) == 1 &&
-               (unsigned int)LittleLong( header[ 2 ] ) == (unsigned int)prog->progs_numglobaldefs &&
-               (unsigned int)LittleLong( header[ 3 ] ) == (unsigned int)prog->progs_numglobals &&
-               (unsigned int)LittleLong( header[ 4 ] ) == (unsigned int)prog->progs_numfielddefs &&
-               (unsigned int)LittleLong( header[ 5 ] ) == (unsigned int)prog->progs_numstatements )
+       if (memcmp(lno, "LNOF", 4) == 0
+       && LittleLong( header[ 1 ] ) == 1
+       && (unsigned int)LittleLong( header[ 2 ] ) == (unsigned int)prog->progs_numglobaldefs
+       && (unsigned int)LittleLong( header[ 3 ] ) == (unsigned int)prog->progs_numglobals
+       && (unsigned int)LittleLong( header[ 4 ] ) == (unsigned int)prog->progs_numfielddefs
+       && (unsigned int)LittleLong( header[ 5 ] ) == (unsigned int)prog->progs_numstatements)
        {
                prog->statement_linenums = (int *)Mem_Alloc(prog->progs_mempool, prog->progs_numstatements * sizeof( int ) );
                memcpy( prog->statement_linenums, header + 6, prog->progs_numstatements * sizeof( int ) );