diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-03 09:12:51 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-04 07:24:30 +0200 |
commit | 0ab4fb7ca60b62d2e54f8afa924062e87bef334e (patch) | |
tree | 4620f88b527e19930d165f8e6fd86ddee078cc76 /cpukit/score/src/objectidtoname.c | |
parent | rtems: Remove task variables (diff) | |
download | rtems-0ab4fb7ca60b62d2e54f8afa924062e87bef334e.tar.bz2 |
score: Fix _Objects_Id_to_name()
Avoid out-of-bounds array access in case the object class is invalid.
Diffstat (limited to '')
-rw-r--r-- | cpukit/score/src/objectidtoname.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/cpukit/score/src/objectidtoname.c b/cpukit/score/src/objectidtoname.c index 674f641ee5..9f50687c60 100644 --- a/cpukit/score/src/objectidtoname.c +++ b/cpukit/score/src/objectidtoname.c @@ -25,8 +25,6 @@ Objects_Name_or_id_lookup_errors _Objects_Id_to_name ( Objects_Name *name ) { - uint32_t the_api; - uint32_t the_class; Objects_Id tmpId; Objects_Information *information; Objects_Control *the_object = (Objects_Control *) 0; @@ -39,16 +37,7 @@ Objects_Name_or_id_lookup_errors _Objects_Id_to_name ( tmpId = (id == OBJECTS_ID_OF_SELF) ? _Thread_Get_executing()->Object.id : id; - the_api = _Objects_Get_API( tmpId ); - 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 ); - - information = _Objects_Information_table[ the_api ][ the_class ]; + information = _Objects_Get_information_id( tmpId ); if ( !information ) return OBJECTS_INVALID_ID; |