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:
Enrico Weigelt, metux IT consult 2025-05-06 16:28:19 +02:00
parent 2be4669988
commit f1e7e52aa3
2 changed files with 4 additions and 2 deletions

View File

@ -888,7 +888,8 @@ RecordInstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
unsigned int j;
for (j = interval.first; j <= interval.last; j++)
pClient->requestVector[j] = RecordARequest;
if (pClient)
pClient->requestVector[j] = RecordARequest;
}
}
}

View File

@ -361,7 +361,8 @@ IntervalListCreateSet(RecordSetInterval * pIntervals, int nIntervals,
goto bailout;
prls->baseSet.ops = &IntervalListSetOperations;
}
memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
if (stackIntervals)
memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
prls->nIntervals = nIntervals;
bailout:
free(stackIntervals);