fjpanag opened a new pull request, #7305: URL: https://github.com/apache/incubator-nuttx/pull/7305
## Summary When the file size is 0 and the data to be written is also 0 (in case of `tmpfs_write()`) then `tfo->tfo_data` will be NULL. Previously, the code used this buffer unconditionally with `memcpy()` (albeit with 0 size), which is wrong. The `memcpy()` arguments must always be non-NULL, regardless of the size. An UBSan warning was also triggered for this. This PR fixes this, ensuring that only non-NULL arguments are provided to memcpy. ## Impact UB fix. ## Testing Tested by writing 0 bytes to an empty tmpfs file. No issues, no UBSan warnings. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
