From 2742886134b8106ae0826d4e48604f0a746d23b8 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Wed, 5 Sep 2018 00:44:27 -0700 Subject: [PATCH] [posix-app] address integer conversions (#3018) --- src/posix/platform/radio_spinel.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/posix/platform/radio_spinel.cpp b/src/posix/platform/radio_spinel.cpp index 5adfef0b6..2e3db71e6 100644 --- a/src/posix/platform/radio_spinel.cpp +++ b/src/posix/platform/radio_spinel.cpp @@ -480,7 +480,14 @@ void RadioSpinel::HandleNotification(const uint8_t *aBuffer, uint16_t aLength) // Some spinel properties cannot be handled during `WaitResponse()`, we must cache these events. // `mWaitingTid` is released immediately after received the response. And `mWaitingKey` is be set // to `SPINEL_PROP_LAST_STATUS` at the end of `WaitResponse()`. - VerifyOrExit(IsSafeToHandleNow(key), error = mFrameQueue.Push(aBuffer, aLength)); + + if (!IsSafeToHandleNow(key)) + { + assert(aLength <= 255); + error = mFrameQueue.Push(aBuffer, static_cast(aLength)); + ExitNow(); + } + HandleValueIs(key, data, static_cast(len)); break; @@ -1110,7 +1117,7 @@ otError RadioSpinel::WriteAll(const uint8_t *aBuffer, uint16_t aLength) while (aLength) { - int rval = write(mSockFd, aBuffer, aLength); + ssize_t rval = write(mSockFd, aBuffer, aLength); if (rval > 0) {