diff --git a/libs/libnx/nxmu/nx_eventhandler.c b/libs/libnx/nxmu/nx_eventhandler.c index 9dadde485f..d9be5d09f9 100644 --- a/libs/libnx/nxmu/nx_eventhandler.c +++ b/libs/libnx/nxmu/nx_eventhandler.c @@ -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 */