about summary refs log tree commit diff
path: root/nptl
diff options
context:
space:
mode:
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog4
-rw-r--r--nptl/pthread_setspecific.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index fc40640a33..f5243c8091 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,5 +1,9 @@
 2006-08-03  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #2892]
+	* pthread_setspecific.c (__pthread_setspecific): Check
+	out-of-range index before checking for unused key.
+
 	* sysdeps/pthread/gai_misc.h: New file.
 
 2006-08-01  Ulrich Drepper  <drepper@redhat.com>
diff --git a/nptl/pthread_setspecific.c b/nptl/pthread_setspecific.c
index b6e66b5f22..152f5590e2 100644
--- a/nptl/pthread_setspecific.c
+++ b/nptl/pthread_setspecific.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -52,8 +52,8 @@ __pthread_setspecific (key, value)
     }
   else
     {
-      if (KEY_UNUSED ((seq = __pthread_keys[key].seq))
-	  || key >= PTHREAD_KEYS_MAX)
+      if (key >= PTHREAD_KEYS_MAX
+	  || KEY_UNUSED ((seq = __pthread_keys[key].seq)))
 	/* Not valid.  */
 	return EINVAL;