From: Michael Tremer Date: Tue, 23 Aug 2022 12:54:12 +0000 (+0000) Subject: hexdump: Don't try to dump any empty memory X-Git-Tag: 0.9.15~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c27aec2469d6687a9252fdd348423f465664fa5;p=location%2Flibloc.git hexdump: Don't try to dump any empty memory Signed-off-by: Michael Tremer --- diff --git a/src/libloc/private.h b/src/libloc/private.h index 2ee97d1..89ce5bc 100644 --- a/src/libloc/private.h +++ b/src/libloc/private.h @@ -66,6 +66,9 @@ static inline void hexdump(struct loc_ctx* ctx, const void* addr, size_t len) { DEBUG(ctx, "Dumping %zu byte(s)\n", len); + if (!len) + return; + // Process every byte in the data for (i = 0; i < len; i++) { // Multiple of 16 means new line (with line offset)