packet: avoid logging uninitialized sequence number
Add a description of the new feature/bug fix. Reference any relevant bugs.
Fix an uninitialized local variable read in ssh_packet_unimplemented().
This was found by DMSAN. A malformed SSH_MSG_UNIMPLEMENTED packet can omit the required 4-byte sequence number. In that case, ssh_buffer_unpack(packet, "d", &seq) fails and leaves seq uninitialized, but the handler still formats seq into the log message.
This change returns after the failed unpack, so malformed SSH_MSG_UNIMPLEMENTED packets are consumed without logging an uninitialized sequence number. Valid packets keep the existing behavior.
No public bug is referenced.
Checklist
- Commits have
Signed-off-by:with name/author being identical to the commit author - Code modified for feature
- Test suite updated with functionality tests
- Test suite updated with negative tests
- Documentation updated
Reviewer's checklist:
- Any issues marked for closing are addressed
- There is a test suite reasonably covering new functionality or modifications
- Function naming, parameters, return values, types, etc., are consistent and according to CONTRIBUTING.md
- This feature/change has adequate documentation added
- No obvious mistakes in the code