record: protect from NULL pointers
Even though the situation probably never happens, but better being extra cautious, just in case. | ../record/set.c: In function ‘IntervalListCreateSet’: | ../record/set.c:364:5: warning: use of NULL ‘stackIntervals’ where non-null expected [CWE-476] [-Wanalyzer-null-argument] | 364 | memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval)); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
2be4669988
commit
f1e7e52aa3
|
@ -888,6 +888,7 @@ RecordInstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
|
||||||
for (j = interval.first; j <= interval.last; j++)
|
for (j = interval.first; j <= interval.last; j++)
|
||||||
|
if (pClient)
|
||||||
pClient->requestVector[j] = RecordARequest;
|
pClient->requestVector[j] = RecordARequest;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,6 +361,7 @@ IntervalListCreateSet(RecordSetInterval * pIntervals, int nIntervals,
|
||||||
goto bailout;
|
goto bailout;
|
||||||
prls->baseSet.ops = &IntervalListSetOperations;
|
prls->baseSet.ops = &IntervalListSetOperations;
|
||||||
}
|
}
|
||||||
|
if (stackIntervals)
|
||||||
memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
|
memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
|
||||||
prls->nIntervals = nIntervals;
|
prls->nIntervals = nIntervals;
|
||||||
bailout:
|
bailout:
|
||||||
|
|
Loading…
Reference in New Issue