From 3c20e46902a3cc11ed00fcdf122f375ed1ca4b6c Mon Sep 17 00:00:00 2001 From: Gustavo Moreira Date: Sun, 1 Dec 2024 12:36:35 +1100 Subject: [PATCH] renderers: Fix HexBytes formatter to apply padding also at the end of the string, ensuring proper output alignment when the pretty renderer justifies each line to the right --- volatility3/cli/text_renderer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/volatility3/cli/text_renderer.py b/volatility3/cli/text_renderer.py index 96970d3ce..31307f67e 100644 --- a/volatility3/cli/text_renderer.py +++ b/volatility3/cli/text_renderer.py @@ -51,8 +51,10 @@ def hex_bytes_as_text(value: bytes, width: int = 16) -> str: # Handle leftovers when the lenght is not mutiple of width if printables: - output += " " * (width - len(printables)) + padding = width - len(printables) + output += " " * (padding) output += printables + output += " " * (padding) return output