From b91b3d807d3e049358027d53ec5e4574e16850b3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 21 Jun 2019 12:04:23 +0200 Subject: record/set.c: silence cpp finding [nx-X11/programs/Xserver/record/set.c:361]: (warning) Possible null pointer dereference: stackIntervals stackIntervals is only NULL if nIntervals is 0, too. In that case memcpy will do nothing and so it is ok to pass NULL as source. But it is ugly nevertheless... --- nx-X11/programs/Xserver/record/set.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nx-X11') diff --git a/nx-X11/programs/Xserver/record/set.c b/nx-X11/programs/Xserver/record/set.c index c3085c54d..3086f9670 100644 --- a/nx-X11/programs/Xserver/record/set.c +++ b/nx-X11/programs/Xserver/record/set.c @@ -357,7 +357,8 @@ IntervalListCreateSet(RecordSetInterval *pIntervals, int nIntervals, if (!prls) goto bailout; prls->baseSet.ops = &IntervalListSetOperations; } - memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval)); + if (nIntervals > 0) + memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval)); prls->nIntervals = nIntervals; bailout: if (stackIntervals) free(stackIntervals); -- cgit v1.2.3