libs/libnx: handle the bad message correctly

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an
2022-02-17 16:52:52 +08:00
committed by Petro Karashchenko
parent 7933442b98
commit 4824ea68a9
+5 -1
View File
@@ -146,7 +146,11 @@ int nx_eventhandler(NXHANDLE handle)
}
while (nbytes < 0);
DEBUGASSERT(nbytes >= sizeof(struct nxclimsg_s));
if (nbytes < sizeof(struct nxclimsg_s))
{
_NX_SETERRNO(EBADMSG);
return ERROR;
}
/* Dispatch the message appropriately */