From f82f8f17cbc608352a991571db7746e515b96cd6 Mon Sep 17 00:00:00 2001 From: Brian Carrier Date: Sat, 26 Aug 2017 17:08:23 -0400 Subject: [PATCH] Prevent out of bounds exception if string is all nulls. --- pe_lib/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pe_lib/utils.h b/pe_lib/utils.h index dc52fc4..17303fe 100644 --- a/pe_lib/utils.h +++ b/pe_lib/utils.h @@ -27,7 +27,7 @@ class pe_utils template static void strip_nullbytes(std::basic_string& str) { - while(!*(str.end() - 1) && !str.empty()) + while(!str.empty() && !*(str.end() - 1)) str.erase(str.length() - 1); }