]> git.ipfire.org Git - location/libloc.git/commitdiff
hexdump: Don't try to dump any empty memory
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 23 Aug 2022 12:54:12 +0000 (12:54 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 23 Aug 2022 12:54:12 +0000 (12:54 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libloc/private.h

index 2ee97d1c4142ab32c26f041fa3cd75fa37e09a64..89ce5bc2853d8a435a43a63bd7b6f952650f4cf0 100644 (file)
@@ -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)