about summary refs log tree commit diff
path: root/src/afl-common.c
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-06-01 11:19:49 +0200
committervanhauser-thc <vh@thc.org>2021-06-01 11:19:49 +0200
commit07c3e47e6beae3e99637f501095bffb95be9f5da (patch)
treee7a87b49877e3b84e993abf25065b236a938685b /src/afl-common.c
parent7e54c8d7f6ad7e07c5c442d2e92eed3da7c4add0 (diff)
downloadafl++-07c3e47e6beae3e99637f501095bffb95be9f5da.tar.gz
fixes
Diffstat (limited to 'src/afl-common.c')
-rw-r--r--src/afl-common.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/afl-common.c b/src/afl-common.c
index 8826de70..c61ce3d8 100644
--- a/src/afl-common.c
+++ b/src/afl-common.c
@@ -479,9 +479,17 @@ void print_suggested_envs(char *mispelled_env) {
 
       size_t end = start + strcspn(afl_env + start, "_") + 1;
       memcpy(reduced, afl_env, start);
-      if (end < afl_env_len)
+      if (end < afl_env_len) {
+
         memcpy(reduced + start, afl_env + end, afl_env_len - end);
-      reduced[afl_env_len - end + start] = 0;
+
+      }
+
+      if (afl_env_len + start >= end) {
+
+        reduced[afl_env_len - end + start] = 0;
+
+      }
 
       int distance = string_distance_levenshtein(reduced, env_name);
       if (distance < ENV_SIMILARITY_TRESHOLD && seen[j] == 0) {