unicorn/include/list.h
BAYET 881e08da01
Fix UAF when deleting hook while in hook callback #1127 (#1130)
* Handle the cpu context save in a more pythonic way, so the context can be serialized and reuse in an other process using the same emulator architecture and modes

* Fix type error ; mistakes a size_t uint64_t ; breaks in 32bit...

* Fix the UAF situation when deleting a hook while being in a hook callback. Added an attribute 'to_delete' to hooks, and a list hooks_to_del to delay the free of the hooks

* Minor fixes ; forgot return type of clear_deleted_hooks ; do not declare variable in for predicate
2020-05-07 14:24:48 +08:00

34 lines
741 B
C

#ifndef UC_LLIST_H
#define UC_LLIST_H
#include "unicorn/platform.h"
struct list_item {
struct list_item *next;
void *data;
};
struct list {
struct list_item *head, *tail;
};
// create a new list
struct list *list_new(void);
// removed linked list nodes but does not free their content
void list_clear(struct list *list);
// insert a new item at the begin of the list.
void *list_insert(struct list *list, void *data);
// append a new item at the end of the list.
void *list_append(struct list *list, void *data);
// returns true if entry was removed, false otherwise
bool list_remove(struct list *list, void *data);
// returns true if the data exists in the list
bool list_exists(struct list *list, void *data);
#endif