mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-26 05:52:03 +00:00
Use standard offsetof facility. Dereferencing a null pointer results
in undefined behaviour.
This commit is contained in:
parent
ed1794fe17
commit
917bca4f7d
2 changed files with 2 additions and 1 deletions
|
@ -160,6 +160,7 @@ typedef int intptr_t;
|
|||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
|
|
|
@ -330,7 +330,7 @@ static void ParseFace( dsurface_t *ds, drawVert_t *verts, msurface_t *surf, int
|
|||
numIndexes = LittleLong( ds->numIndexes );
|
||||
|
||||
// create the srfSurfaceFace_t
|
||||
sfaceSize = ( size_t ) &((srfSurfaceFace_t *)0)->points[numPoints];
|
||||
sfaceSize = offsetof( srfSurfaceFace_t, points ) + sizeof( *cv->points ) * numPoints;
|
||||
ofsIndexes = sfaceSize;
|
||||
sfaceSize += sizeof( int ) * numIndexes;
|
||||
|
||||
|
|
Loading…
Reference in a new issue