You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a bug in aws_iot_mqtt_internal_send_packet() function.
If network stack write function is not able to send the full packet size (say there is a limitation on the network stack side which only allows to send 256 bytes at a time), the send function will try to send the rest of the write buffer in the socket until it send all the data. The function will adjust the pointer to the write buffer, but will not adjust the length of the data left on the buffer. Potentially it may lead to accessing data outside of the write buffer, but in my case it also breaks the code.
sentLen = 0;
sent = 0;
while(sent < length && !has_timer_expired(pTimer)) {
rc = pClient->networkStack.write(&(pClient->networkStack),
&pClient->clientData.writeBuf[sent], ===> length <===, pTimer,
&sentLen);
if(SUCCESS != rc) {
/* there was an error writing the data */
break;
}
sent += sentLen;
}
Thanks,
-Dmitry
The text was updated successfully, but these errors were encountered:
Hi @Borschtsch,
Thank you for pointing this out. I have made a note of this in our internal bug tracker and we will include a fix for this issue in the next version of the SDK. The fix should be simply using "length - sent" instead of length in the write call.
Please do let us know if you have any further suggestions for improvements to the SDK. Your feedback is very important. Thank you for using AWS IoT.
Hello,
There is a bug in aws_iot_mqtt_internal_send_packet() function.
If network stack write function is not able to send the full packet size (say there is a limitation on the network stack side which only allows to send 256 bytes at a time), the send function will try to send the rest of the write buffer in the socket until it send all the data. The function will adjust the pointer to the write buffer, but will not adjust the length of the data left on the buffer. Potentially it may lead to accessing data outside of the write buffer, but in my case it also breaks the code.
Thanks,
-Dmitry
The text was updated successfully, but these errors were encountered: