diff options
| author | 2026-02-13 07:36:46 +0200 | |
|---|---|---|
| committer | 2026-02-14 19:17:26 +0200 | |
| commit | 61636353617271a7a25335111a8b4dfc7a70a139 (patch) | |
| tree | 3a568ab702b283a770815f929da439cd6c4f4590 | |
| parent | 74e3bd9286d16fc1290abde061ee00831d5b36f8 (diff) | |
| download | idevicerestore-61636353617271a7a25335111a8b4dfc7a70a139.tar.gz idevicerestore-61636353617271a7a25335111a8b4dfc7a70a139.tar.bz2 | |
| -rw-r--r-- | src/log.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -175,7 +175,15 @@ void logger_dump_hex(enum loglevel level, const void* buf, size_t len) mutex_lock(&log_mutex); - fs = (char*)malloc(len * 3 + 1); + fs = (char*)malloc((len == 0) ? 2 : (len * 3 + 1)); + if (!fs) { + mutex_unlock(&log_mutex); + return; + } + if (len == 0) { + fs[0] = '\n'; + fs[1] = '\0'; + } for (unsigned int i = 0; i < len; i++) { snprintf(fs + i*3, 4, "%02x%c", ((unsigned char*)buf)[i], (i < len-1) ? ' ' : '\n'); } |
