This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
No checking of index while accessing file descriptor table might lead to a crash
- From: sebastien Couret <sebastien dot couret at elios-informatique dot fr>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Wed, 10 Mar 2004 13:30:19 +0100
- Subject: [ECOS] No checking of index while accessing file descriptor table might lead to a crash
- Organization: Elios Informatique
- Reply-to: sebastien dot couret at elios-informatique dot fr
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