Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#618 closed defect (fixed)

Add NULL checks to Classic API arguments

Reported by: Joel Sherrill Owned by: Joel Sherrill
Priority: normal Milestone: 2
Component: score Version: 4.6
Severity: major Keywords:
Cc: bugs@… Blocked By:
Blocking:

Description

The RTEID specification did not require and seemed to discourage checking for NULL on arguments. This is now best remembered as a quaint reflection of the times when embedded systems were often and used 0 as a real program address. The attached patch adds the following null checks and corresponding documentation changes
score/src/object.h - add invalid address as error from object name to id
score/src/objectnametoid.c - add null id check
score/src/coretodvalidate.c - add null TOD check
rtems/include/rtems/rtems/status.h - add invalid address
rtems/src/clockget.c - null time_buffer check
rtems/src/clockset.c - null time_buffer check
rtems/src/dpcreate.c - null ID check
rtems/src/dpmemexternal2internal.c - null internal arg check
rtems/src/dpmeminternal2external.c - null external arg check
rtems/src/eventreceive.c - null event out
rtems/src/msgqbroadcast.c - null count check, null buffer check
rtems/src/msgqcreate.c - null ID check
rtems/src/msgqflush.c - null count check
rtems/src/msgqgetnumberpending.c - null count check
rtems/src/msgqreceive.c - null count check, null buffer check
rtems/src/msgqsubmit.c - null buffer
rtems/src/partcreate.c - null ID check, null buffer check
rtems/src/partgetbuffer.c - null buffer check
rtems/src/ratemoncreate.c - null ID check
rtems/src/regioncreate.c - null ID check, null buffer check
rtems/src/regionextend.c - null address check
rtems/src/regiongetsegment.c - null output segment check
rtems/src/regiongetsegmentsize.c - null segment check, null size check
rtems/src/semcreate.c - null ID check
rtems/src/taskcreate.c - null ID check
rtems/src/taskgetnote.c - null note check
rtems/src/taskmode.c - null previous mode check
rtems/src/taskvariableadd.c - null task_variable check
rtems/src/taskvariableget.c - null task_variable check, null result check
rtems/src/taskvariabledelete.c - null task_variable check
rtems/src/taskwakewhen.c - null time_buffer check
rtems/src/timercreate.c - null ID check
rtems/src/timerfireafter.c - null routine check
rtems/src/timerfirewhen.c - null routine check
rtems/src/timerserverfireafter.c - null routine check
rtems/src/timerserverfirewhen.c - null routine check

Corresponding documentation changed with following additions:

Plus spacing changes as spotted.

clock_tick had wrong comment on status
Ada task mode was wrong prototype

Release:
RTEMS-4.6 and CVS

Attachments (3)

nulltest.c (13.5 KB) - added by Joel Sherrill on 12/03/06 at 13:31:13.
nulltest.c
null-4.6.diff (53.3 KB) - added by Joel Sherrill on 12/03/06 at 13:31:13.
null-4.6.diff
null-cvs.diff (53.5 KB) - added by Joel Sherrill on 12/03/06 at 13:31:13.
null-cvs.diff

Download all attachments as: .zip

Change History (2)

comment:1 Changed on 05/06/04 at 20:03:02 by Joel Sherrill

Status: assignedclosed

State-Changed-From-To: open->closed
State-Changed-Why: Patches committed

Changed on 12/03/06 at 13:31:13 by Joel Sherrill

Attachment: nulltest.c added

nulltest.c

Note: See TracTickets for help on using tickets.