Prototype doesn't mention anything about how an error might surface via the API.
An error value being set when the length value being parsed is detected to be invalid, is redundant and not surfaced because the scope of the variable it is assigned to does not extend past the loop.
Similar story as the previous point (with regard to the error value being lost), except in the case of fetching the next character.
Return value is not affected by any of the error checking.
Output "length" value is not affected by any of the error checking.
Is MQTTPacket_decode() intentionally implemented this way? If so, why aren't the errors (from parsing untrusted input) bubbled up?
Is
MQTTPacket_decode()
intentionally implemented this way? If so, why aren't the errors (from parsing untrusted input) bubbled up?