From c2c749f0f784ef91e3b5d96cab173a6e80c8f7ed Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Sun, 14 Jan 2024 15:59:31 +0100 Subject: [PATCH] Fix hexdump math-error on empty input --- sopass.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sopass.py b/sopass.py index aace876..0afbb6a 100755 --- a/sopass.py +++ b/sopass.py @@ -25,7 +25,7 @@ class Direction: def hexdump(data: bytes) -> list[str]: # We will be prefixing the lines with sigils, so no need to join. result = [] offset = 0 - offset_len = math.ceil(math.log(len(data), 16)) + offset_len = math.ceil(math.log(len(data)+1, 16)) while data: left_chunk, right_chunk, data = data[:8], data[8:16], data[16:] left_ascii = ''.join(chr(x) if x in range(32,127) else '.' for x in left_chunk)