[BugFix] Buffering.c NULL src for memcpy is UB -- ASAN

No clue if our implementation would suffer the same fate
but the C standard states:
Where an argument declared as size_t n specifies
the length of the array for a function, n can have
the value zero […] pointer arguments on such a call
shall still have valid values, as described in 7.1.4.

Change-Id: Iee0dd9c948c6ad4b0d96309053127ab11111f04c
This commit is contained in:
William Wilgus 2023-01-04 20:15:31 -05:00
parent a23ae63a31
commit ea33e66021

View file

@ -416,6 +416,7 @@ add_handle(unsigned int flags, size_t data_size, const char *path,
h->signaled = 0; /* Data can be waited for */ h->signaled = 0; /* Data can be waited for */
/* Save the provided path */ /* Save the provided path */
if (path)
memcpy(h->path, path, pathsize); memcpy(h->path, path, pathsize);
/* Return the start of the data area */ /* Return the start of the data area */