named-data-iot / ndn-iot-package-over-posix

NDN IoT Package over POSIX with CMake
7 stars 9 forks source link

fix udp-face.c recvfrom EINVAL #16

Closed MixusMinimax closed 1 month ago

MixusMinimax commented 1 month ago

Problem

This recvfrom call returns -1, and errno is 22 (EINVAL). This is because addr_len is not initialized.

https://github.com/named-data-iot/ndn-iot-package-over-posix/blob/f5103fd2e855b151efe22d183cb5a62252ec6a8c/adaptation/udp/udp-face.c#L203-L211

Solution

initialize addr_len, as it is an in/out argument, not just an out argument. SO: https://stackoverflow.com/a/3002464