From 2a4eaa927eaa8ccb4b819ad41bb308e433b48820 Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Sun, 19 Mar 2017 21:21:19 +0100 Subject: [PATCH] avoid searching 0-length in memory (#181) This will result in an internal exception and make pwndbg stop searching. Just avoid and exit this search block if the current search length equals zero. --- pwndbg/search.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pwndbg/search.py b/pwndbg/search.py index 8cdfcb09c..913e2f174 100644 --- a/pwndbg/search.py +++ b/pwndbg/search.py @@ -49,7 +49,11 @@ def search(searchfor, mapping=None, start=None, end=None, if not pwndbg.memory.peek(start): break - start = i.search_memory(start, end - start, searchfor) + length = end - start + if length <= 0: + break + + start = i.search_memory(start, length, searchfor) if start is None: break