libs/netdb: add sanity check to avoid null pointer reference

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an
2023-01-30 16:26:32 +08:00
committed by Xiang Xiao
parent 6f2f62f4ce
commit fa63da22ae
+4 -1
View File
@@ -737,7 +737,10 @@ int gethostentbyname_r(FAR const char *name,
}
else if ((flags & AI_NUMERICHOST) != 0)
{
*h_errnop = EAI_NONAME;
if (h_errnop)
{
*h_errnop = EAI_NONAME;
}
return ERROR;
}