[ECOS] No checking of index while accessing file descriptor table might lead to a crash
sebastien Couret
sebastien.couret@elios-informatique.fr
Wed Mar 10 12:28:00 GMT 2004
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
More information about the Ecos-discuss
mailing list