Skip to content

logger: fix crash and undefined behavior in logger_dump_hex with zero-length buffers#776

Merged
nikias merged 1 commit intolibimobiledevice:masterfrom
skortela:log-crash-fix
Feb 16, 2026
Merged

logger: fix crash and undefined behavior in logger_dump_hex with zero-length buffers#776
nikias merged 1 commit intolibimobiledevice:masterfrom
skortela:log-crash-fix

Conversation

@skortela
Copy link
Contributor

Fix undefined behavior and potential crash in logger_dump_hex() when called with a zero-length buffer.

Previously, the function allocated a 1-byte buffer but did not initialize it. This uninitialized buffer was later passed to %s formatting functions, causing an out-of-bounds read until a random null terminator was encountered. On Windows, this could trigger an access violation and crash the process.

This situation can occur when dumping nonces or other binary data if the reported length is zero due to device communication issues or unexpected conditions.

@nikias
Copy link
Member

nikias commented Feb 14, 2026

Would you mind squashing the commits?

@skortela
Copy link
Contributor Author

Squashed commits.

@nikias nikias merged commit 6163635 into libimobiledevice:master Feb 16, 2026
5 checks passed
@skortela skortela deleted the log-crash-fix branch February 16, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants