summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-06-04 23:05:37 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-06-04 23:05:37 +0000
commitd8d373a1f24624aa8098e182d49cd8b4af9eea72 (patch)
treeb02fef3e828d60ed03d0329488982b04c5cfc070 /cpukit
parent2008-06-04 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-d8d373a1f24624aa8098e182d49cd8b4af9eea72.tar.bz2
2008-06-04 Joel Sherrill <joel.sherrill@OARcorp.com>
* score/src/objectgetinfo.c, score/src/objectidtoname.c, score/src/threadget.c: Make sure the pointer to the API object table is valid before derefencing it.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/ChangeLog6
-rw-r--r--cpukit/score/src/objectgetinfo.c3
-rw-r--r--cpukit/score/src/objectidtoname.c5
-rw-r--r--cpukit/score/src/threadget.c9
4 files changed, 21 insertions, 2 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog
index f93c13c23b..bc88d6a336 100644
--- a/cpukit/ChangeLog
+++ b/cpukit/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-04 Joel Sherrill <joel.sherrill@OARcorp.com>
+
+ * score/src/objectgetinfo.c, score/src/objectidtoname.c,
+ score/src/threadget.c: Make sure the pointer to the API object table
+ is valid before derefencing it.
+
2008-06-02 Joel Sherrill <joel.sherrill@oarcorp.com>
* score/include/rtems/score/interr.h, score/src/interr.c: Convention
diff --git a/cpukit/score/src/objectgetinfo.c b/cpukit/score/src/objectgetinfo.c
index 8697c227e6..c7d7d81b06 100644
--- a/cpukit/score/src/objectgetinfo.c
+++ b/cpukit/score/src/objectgetinfo.c
@@ -31,6 +31,9 @@ Objects_Information *_Objects_Get_information(
if ( !the_class || the_class > _Objects_API_maximum_class(the_api) )
return NULL;
+ if ( !_Objects_Information_table[ the_api ] )
+ return NULL;
+
info = _Objects_Information_table[ the_api ][ the_class ];
if ( !info )
return NULL;
diff --git a/cpukit/score/src/objectidtoname.c b/cpukit/score/src/objectidtoname.c
index 52a4813815..de34dc5fa1 100644
--- a/cpukit/score/src/objectidtoname.c
+++ b/cpukit/score/src/objectidtoname.c
@@ -54,7 +54,10 @@ Objects_Name_or_id_lookup_errors _Objects_Id_to_name (
tmpId = (id == OBJECTS_ID_OF_SELF) ? _Thread_Executing->Object.id : id;
the_api = _Objects_Get_API( tmpId );
- if ( the_api && the_api > OBJECTS_APIS_LAST )
+ if ( !_Objects_Is_api_valid( the_api ) )
+ return OBJECTS_INVALID_ID;
+
+ if ( !_Objects_Information_table[ the_api ] )
return OBJECTS_INVALID_ID;
the_class = _Objects_Get_class( tmpId );
diff --git a/cpukit/score/src/threadget.c b/cpukit/score/src/threadget.c
index 126a6cc69f..d7d9106998 100644
--- a/cpukit/score/src/threadget.c
+++ b/cpukit/score/src/threadget.c
@@ -53,6 +53,7 @@ Thread_Control *_Thread_Get (
{
uint32_t the_api;
uint32_t the_class;
+ Objects_Information **api_information;
Objects_Information *information;
Thread_Control *tp = (Thread_Control *) 0;
@@ -75,7 +76,13 @@ Thread_Control *_Thread_Get (
goto done;
}
- information = _Objects_Information_table[ the_api ][ the_class ];
+ api_information = _Objects_Information_table[ the_api ];
+ if ( !api_information ) {
+ *location = OBJECTS_ERROR;
+ goto done;
+ }
+
+ information = api_information[ the_class ];
if ( !information ) {
*location = OBJECTS_ERROR;
goto done;