Use standard offsetof facility. Dereferencing a null pointer results
in undefined behaviour.
This commit is contained in:
1 parent
ed1794fe17
commit
917bca4f7d
2 files changed
+2
-1
No files matched your search
@@ -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;
|
||||
|
||||
|
||||
Reference in new issue
Block a user