diff options
authorWilliam Wilgus <>2023-01-04 20:15:31 -0500
committerWilliam Wilgus <>2023-01-04 20:20:08 -0500
commitea33e660211ea762e0ab4b820b500db1b0c91337 (patch)
parenta23ae63a317d73802edaf1d6d9a618ad9caaf8a9 (diff)
[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
1 files changed, 2 insertions, 1 deletions
diff --git a/apps/buffering.c b/apps/buffering.c
index 9743c9c319..81b861ccf1 100644
--- a/apps/buffering.c
+++ b/apps/buffering.c
@@ -416,7 +416,8 @@ add_handle(unsigned int flags, size_t data_size, const char *path,
h->signaled = 0; /* Data can be waited for */
/* Save the provided path */
- memcpy(h->path, path, pathsize);
+ if (path)
+ memcpy(h->path, path, pathsize);
/* Return the start of the data area */
*data_out = ringbuf_add(index, handlesize);