summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2003-05-06 02:33:49 +0000
committermtm <mtm@FreeBSD.org>2003-05-06 02:33:49 +0000
commitbbd203a2167bb625ecc13db26f17f3246b91f7f1 (patch)
tree38b581fc22903140dc84cb55dd9e292ee8becf58 /lib
parentda28dc62d70922594e0170d771312b4fb8455eaa (diff)
downloadFreeBSD-src-bbd203a2167bb625ecc13db26f17f3246b91f7f1.zip
FreeBSD-src-bbd203a2167bb625ecc13db26f17f3246b91f7f1.tar.gz
Fix a null dereference leading to a core dump when
the number of threads exceeds the number of open slots in ldt_entries[]. Approved by: markm (mentor)(implicit) Reviewed by: jeff
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/arch/i386/i386/_setcurthread.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libthr/arch/i386/i386/_setcurthread.c b/lib/libthr/arch/i386/i386/_setcurthread.c
index 29cd646..94c6561 100644
--- a/lib/libthr/arch/i386/i386/_setcurthread.c
+++ b/lib/libthr/arch/i386/i386/_setcurthread.c
@@ -62,7 +62,10 @@ ldt_init(void)
void
_retire_thread(void *entry)
{
- *(void **)entry = *ldt_free;
+ if (ldt_free == NULL)
+ *(void **)entry = NULL;
+ else
+ *(void **)entry = *ldt_free;
ldt_free = entry;
}
OpenPOWER on IntegriCloud