summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2023-01-04 20:15:31 -0500
committerWilliam Wilgus <wilgus.william@gmail.com>2023-01-04 20:20:08 -0500
commitea33e660211ea762e0ab4b820b500db1b0c91337 (patch)
tree5776c20c180fc556da0f6e4154d09b951e305c50 /apps
parenta23ae63a317d73802edaf1d6d9a618ad9caaf8a9 (diff)
downloadrockbox-ea33e660211ea762e0ab4b820b500db1b0c91337.tar.gz
rockbox-ea33e660211ea762e0ab4b820b500db1b0c91337.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
Diffstat (limited to 'apps')
-rw-r--r--apps/buffering.c3
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,
416 h->signaled = 0; /* Data can be waited for */ 416 h->signaled = 0; /* Data can be waited for */
417 417
418 /* Save the provided path */ 418 /* Save the provided path */
419 memcpy(h->path, path, pathsize); 419 if (path)
420 memcpy(h->path, path, pathsize);
420 421
421 /* Return the start of the data area */ 422 /* Return the start of the data area */
422 *data_out = ringbuf_add(index, handlesize); 423 *data_out = ringbuf_add(index, handlesize);