[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH v2 1/2] lib/ukmmap: fix null pointer dereferences
Reviewed-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx> On 3/8/20 2:24 PM, Hugo Lefeuvre wrote: mmap allocates buffers via malloc and dereference returned pointers without NULL checking, causing crashes in OOM situations. Signed-off-by: Hugo Lefeuvre <hugo.lefeuvre@xxxxxxxxx> --- lib/ukmmap/mmap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ukmmap/mmap.c b/lib/ukmmap/mmap.c index 7cee8dc..39ecbef 100644 --- a/lib/ukmmap/mmap.c +++ b/lib/ukmmap/mmap.c @@ -101,6 +101,12 @@ void *mmap(void *addr, size_t len, int prot, return (void *) -1; } new = uk_malloc(uk_alloc_get_default(), sizeof(struct mmap_addr)); + + if (!new) { + uk_free(uk_alloc_get_default(), mem); + errno = ENOMEM; + return (void *) -1; + } new->begin = mem; new->end = mem + len; new->next = NULL; _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |