This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

No checking of index while accessing file descriptor table might lead to a crash


Hello All,

I was playing around trying to write down an 'lsof' style application for 
eCOS but my application was crashing again and again.

I finally come into the file
[ECOS_REPOSITORY]/io/fileio/current/src/fd.cxx
to see that file descriptors are stored in a table named desc of size 
CYGNUM_FILEIO_NFD.

What surprised me in that the file descriptor index is not checked while 
accessing to this table (a.k.a check 0<fd<CYGNUM_FILEIO_NFD)

As a result,I think this functions will probably crash, if u pass an fd 
>=CYGNUM_FILEIO_NFD to them.

 fd_close
 cyg_fd_assign
 cyg_fd_free
 cyg_fp_get


It might be usefull  to add an "assert(0<fd<CYGNUM_FILEIO_NFD);" at the 
beginning of the previous functions.
 
What do U think of it ?




-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]