io: clean up Harmony send size clamp

- read TCPIP_TCP_PutIsReady() before comparing, and cast so the
  clamp is not a signed/unsigned comparison
- no behaviour change, the API returns uint16_t

Issue: F-7509
pull/1154/head
John Safranek 2026-08-04 15:52:24 -07:00 committed by JacobBarthelmeh
parent 7e56f10b81
commit e52fbd1f2c
1 changed files with 4 additions and 3 deletions

View File

@ -408,13 +408,14 @@ int wsEmbedSend(WOLFSSH* ssh, void* data, word32 sz, void* ctx)
}
/* not enough space to send */
if ((sent = TCPIP_TCP_PutIsReady(sd)) < sz) {
sz = sent;
}
sent = (int)TCPIP_TCP_PutIsReady(sd);
if (sent == 0) {
/* In the case that 0 is returned the main TCP loop needs to be called */
return WS_CBIO_ERR_WANT_WRITE;
}
if ((word32)sent < sz) {
sz = (word32)sent;
}
#endif /* MICROCHIP_MPLAB_HARMONY */
sent = (int)SEND_FUNCTION(sd, buf, sz, ssh->wflags);