summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-05-21 13:53:01 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-05-21 13:53:01 +0000
commitb20b8aa1d498ce0144db31de4bb36d279c78a0be (patch)
tree2e74c4f80773b7a0fdd72046b1b1d123bf73dd67
parent574403f572ea01e86c7bd41e69ffcc93700724e3 (diff)
2009-05-21 Joel Sherrill <joel.sherrill@OARcorp.com>
PR 1414/cpukit * score/src/objectget.c, score/src/objectgetisr.c, score/src/objectgetnoprotection.c: Tighten math on extraction of index so it is harder to trick by passing in a valid id of an incorrect object class.
-rw-r--r--cpukit/ChangeLog8
-rw-r--r--cpukit/score/src/objectget.c11
-rw-r--r--cpukit/score/src/objectgetisr.c7
-rw-r--r--cpukit/score/src/objectgetnoprotection.c9
4 files changed, 11 insertions, 24 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index 38d9b44754..168cc89041 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,11 @@
+2009-05-21 Joel Sherrill <joel.sherrill@OARcorp.com>
+
+ PR 1414/cpukit
+ * score/src/objectget.c, score/src/objectgetisr.c,
+ score/src/objectgetnoprotection.c: Tighten math on extraction of
+ index so it is harder to trick by passing in a valid id of an
+ incorrect object class.
+
2009-03-12 Santosh G Vattam <vattam.santosh@gmail.com>
PR 1378/filesystem
diff --git a/cpukit/score/src/objectget.c b/cpukit/score/src/objectget.c
index dd798a8976..054170cdaa 100644
--- a/cpukit/score/src/objectget.c
+++ b/cpukit/score/src/objectget.c
@@ -2,7 +2,7 @@
* Object Handler
*
*
- * COPYRIGHT (c) 1989-1999.
+ * COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -57,16 +57,9 @@ Objects_Control *_Objects_Get(
Objects_Control *the_object;
uint32_t index;
-#if defined(RTEMS_MULTIPROCESSING)
index = id - information->minimum_id + 1;
-#else
- /* index = _Objects_Get_index( id ); */
- index = id & 0x0000ffff;
- /* This should work but doesn't always :( */
- /* index = (uint16_t ) id; */
-#endif
- if ( information->maximum >= index ) {
+ if ( information->maximum >= index ) {
_Thread_Disable_dispatch();
if ( (the_object = information->local_table[ index ]) != NULL ) {
*location = OBJECTS_LOCAL;
diff --git a/cpukit/score/src/objectgetisr.c b/cpukit/score/src/objectgetisr.c
index 8a53c7b8b5..aca5f0d059 100644
--- a/cpukit/score/src/objectgetisr.c
+++ b/cpukit/score/src/objectgetisr.c
@@ -61,14 +61,7 @@ Objects_Control *_Objects_Get_isr_disable(
uint32_t index;
ISR_Level level;
-#if defined(RTEMS_MULTIPROCESSING)
index = id - information->minimum_id + 1;
-#else
- /* index = _Objects_Get_index( id ); */
- index = id & 0x0000ffff;
- /* This should work but doesn't always :( */
- /* index = (uint16_t ) id; */
-#endif
_ISR_Disable( level );
if ( information->maximum >= index ) {
diff --git a/cpukit/score/src/objectgetnoprotection.c b/cpukit/score/src/objectgetnoprotection.c
index 7f3981e1e0..edcba5e7f8 100644
--- a/cpukit/score/src/objectgetnoprotection.c
+++ b/cpukit/score/src/objectgetnoprotection.c
@@ -57,16 +57,9 @@ Objects_Control *_Objects_Get_no_protection(
Objects_Control *the_object;
uint32_t index;
-#if defined(RTEMS_MULTIPROCESSING)
index = id - information->minimum_id + 1;
-#else
- /* index = _Objects_Get_index( id ); */
- index = id & 0x0000ffff;
- /* This should work but doesn't always :( */
- /* index = (uint16_t ) id; */
-#endif
- if ( information->maximum >= index ) {
+ if ( information->maximum >= index ) {
if ( (the_object = information->local_table[ index ]) != NULL ) {
*location = OBJECTS_LOCAL;
return the_object;