From 7382ac88d5ba8e4d904265a0b66badf673223000 Mon Sep 17 00:00:00 2001 From: Qualys Security Advisory Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] proc/slab.c: Initialize struct slab_info in get_slabnode(). Especially its "next" member: this is what caused the crash in "slabtop: Reset slab_list if get_slabinfo() fails." (if parse_slabinfo*() fails in sscanf(), for example, then curr is set to NULL but it is already linked into the "list" and its "next" member was never initialized). --- proc/slab.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proc/slab.c b/proc/slab.c index 4bafad01..57370944 100644 --- a/proc/slab.c +++ b/proc/slab.c @@ -48,6 +48,7 @@ static struct slab_info *free_index; */ static struct slab_info *get_slabnode(void) { + static const struct slab_info initializer; struct slab_info *node; if (free_index) { @@ -56,7 +57,7 @@ static struct slab_info *get_slabnode(void) } else { node = xmalloc(sizeof(struct slab_info)); } - + *node = initializer; return node; }