From 28e4b381095d5cfd8d58fcc924008043fb02a5ec Mon Sep 17 00:00:00 2001 From: WorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com> Date: Fri, 2 Jun 2023 10:27:19 +0100 Subject: [PATCH] Fix libafl_maps_next (#24) Co-authored-by: Your Name --- linux-user/syscall.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index d260e03513..e487ef25ba 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -13525,10 +13525,7 @@ GSList * libafl_maps_next(GSList *map_info, struct libafl_mapinfo* ret); GSList * libafl_maps_next(GSList *map_info, struct libafl_mapinfo* ret) { if (!map_info || !ret) return NULL; - GSList *s = g_slist_next(map_info); - if (!s) - return NULL; - MapInfo *e = (MapInfo *) s->data; + MapInfo *e = (MapInfo *)map_info->data; if (h2g_valid(e->start)) { unsigned long min = e->start; @@ -13539,7 +13536,7 @@ GSList * libafl_maps_next(GSList *map_info, struct libafl_mapinfo* ret) { max : (uintptr_t) g2h_untagged(GUEST_ADDR_MAX) + 1; if (page_check_range(h2g(min), max - min, flags) == -1) { - return libafl_maps_next(s, ret); + return libafl_maps_next(g_slist_next(map_info), ret); } int libafl_flags = 0; @@ -13553,10 +13550,10 @@ GSList * libafl_maps_next(GSList *map_info, struct libafl_mapinfo* ret) { ret->path = e->path; ret->flags = libafl_flags; ret->is_priv = e->is_priv; - - return s; + + return g_slist_next(map_info); } else { - return libafl_maps_next(s, ret); + return libafl_maps_next(g_slist_next(map_info), ret); } }