This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 495fd3ca7503fb9a77f0dd5205cc92b06bd1a392 Author: wangjianyu3 <[email protected]> AuthorDate: Tue Sep 1 10:04:27 2026 +0800 libc/netdb: Fix the failure check of getaddrinfo() in rexec_af(). getaddrinfo() reports failure with a positive EAI_* code and leaves res unset, so the "if (ret < 0)" check never caught a failed lookup and the code below dereferenced a NULL res. Treat any non-zero return as failure. Signed-off-by: wangjianyu3 <[email protected]> Signed-off-by: ganjing <[email protected]> --- libs/libc/netdb/lib_rexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libc/netdb/lib_rexec.c b/libs/libc/netdb/lib_rexec.c index 05e9c40157c..bc761f4ea2e 100644 --- a/libs/libc/netdb/lib_rexec.c +++ b/libs/libc/netdb/lib_rexec.c @@ -80,7 +80,7 @@ int rexec_af(FAR char **ahost, int inport, FAR const char *user, hints.ai_flags = AI_CANONNAME; ret = getaddrinfo(*ahost, port_str, &hints, &res); - if (ret < 0) + if (ret != 0) { return -1; }
