You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "anchao (via GitHub)" <gi...@apache.org> on 2026/10/21 05:20:23 UTC
[PR] net/socket: fix recvfrom kernel copyout length [nuttx]
anchao opened a new pull request, #20856:
URL: https://github.com/apache/nuttx/pull/20856
## Summary
Fix the `recvfrom()` user buffer copyout size in kernel builds.
When `CONFIG_BUILD_KERNEL` is enabled, `recvfrom()` receives data into a
temporary kernel buffer before copying the result back to the user buffer.
The previous code copied the full requested length (`len`) regardless of
how many bytes were actually received.
For short receives, this could copy uninitialized bytes from the temporary
kernel buffer back to user space.
This change copies data back only when bytes were received, and limits the
copyout length to the actual return value from `psock_recvfrom()`.
It also avoids copying the source address back to user space when the
receive operation failed.
## Impact
- Prevents copying uninitialized kernel-buffer bytes on short receives.
- Avoids user address copyout on failed receives.
- Affects only `CONFIG_BUILD_KERNEL` builds.
- Non-kernel builds are unchanged.
## Testing
rv-virt/netnsh64
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] net/socket: fix recvfrom kernel copyout length [nuttx]
Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #20856:
URL: https://github.com/apache/nuttx/pull/20856
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] net/socket: fix recvfrom kernel copyout length [nuttx]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #20856:
URL: https://github.com/apache/nuttx/pull/20856#issuecomment-6309612127
<!-- membrowse-pr-comment -->
## <img src="https://membrowse.com/membrowse-logo.svg" height="24" align="top"> MemBrowse Memory Report · [Explore what changed →](https://membrowse.com/public/apache/nuttx?commit_sha=a13623c93899c03fad696feed79d4a4bc1370bb4)
*No memory changes detected for:*
- [arduino-mega2560](https://membrowse.com/public/apache/nuttx/target/arduino-mega2560/compare?head=a13623c93899c03fad696feed79d4a4bc1370bb4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [esp32-devkitc](https://membrowse.com/public/apache/nuttx/target/esp32-devkitc/compare?head=a13623c93899c03fad696feed79d4a4bc1370bb4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [hifive1-revb](https://membrowse.com/public/apache/nuttx/target/hifive1-revb/compare?head=a13623c93899c03fad696feed79d4a4bc1370bb4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [mirtoo](https://membrowse.com/public/apache/nuttx/target/mirtoo/compare?head=a13623c93899c03fad696feed79d4a4bc1370bb4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [qemu-armv8a](https://membrowse.com/public/apache/nuttx/target/qemu-armv8a/compare?head=a13623c93899c03fad696feed79d4a4bc1370bb4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [qemu-intel64](https://membrowse.com/public/apache/nuttx/target/qemu-intel64/compare?head=a13623c93899c03fad696feed79d4a4bc1370bb4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [rx65n-rsk2mb](https://membrowse.com/public/apache/nuttx/target/rx65n-rsk2mb/compare?head=a13623c93899c03fad696feed79d4a4bc1370bb4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [s698pm-dkit](https://membrowse.com/public/apache/nuttx/target/s698pm-dkit/compare?head=a13623c93899c03fad696feed79d4a4bc1370bb4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
- [stm32-nucleo-f103rb](https://membrowse.com/public/apache/nuttx/target/stm32-nucleo-f103rb/compare?head=a13623c93899c03fad696feed79d4a4bc1370bb4&base=a16dbf2100e6a1484a59cb41826034d01834b36d)
---
<sub>Catch memory regressions in CI with [MemBrowse](https://membrowse.com). Free for open source.</sub>
--
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: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org