diff options
author | William Wilgus <wilgus.william@gmail.com> | 2023-01-04 20:15:31 -0500 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2023-01-04 20:20:08 -0500 |
commit | ea33e660211ea762e0ab4b820b500db1b0c91337 (patch) | |
tree | 5776c20c180fc556da0f6e4154d09b951e305c50 | |
parent | a23ae63a317d73802edaf1d6d9a618ad9caaf8a9 (diff) | |
download | rockbox-ea33e66021.tar.gz rockbox-ea33e66021.zip |
[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
-rw-r--r-- | apps/buffering.c | 3 |
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); |