diff --git a/lib/libthr/arch/i386/i386/_setcurthread.c b/lib/libthr/arch/i386/i386/_setcurthread.c index 2e8150f233be..7eac3ba7804c 100644 --- a/lib/libthr/arch/i386/i386/_setcurthread.c +++ b/lib/libthr/arch/i386/i386/_setcurthread.c @@ -50,10 +50,10 @@ ldt_init(void) ldt_free = &ldt_entries[NLDT]; - for (i = 0; i < MAXTHR; i++) + for (i = 0; i < MAXTHR - 1; i++) ldt_entries[i] = (void *)&ldt_entries[i + 1]; - ldt_entries[MAXTHR] = NULL; + ldt_entries[MAXTHR - 1] = NULL; ldt_inited = 1; }