[ECOS] cyg_mtab_lookup()

Nick Garnett nickg@calivar.demon.co.uk
Wed Jun 26 19:46:00 GMT 2002


Roland Caßebohm <roland.cassebohm@visionsystems.de> writes:

> I wanted to open a serial line ("/dev/ser0") but if somebody type a wrong 
> pathname of it or maybe nothing ("") open() cause a hardware exception  
> because of the NULL-pointer.
> I think in this case open() should return an error but should not cause an 
> hardware exception.
> 

Of course I could say that it is the application's job to validate
user input. But actually you are probably right. The simplest fix for
this would be to change the line in cyg_mtab_lookup() to:

    // Unrooted file names go straight to current dir
    if( **name != '/' ) return (*mte==NULL)?-1:0;


Let us know if this works.



-- 
Nick Garnett - eCos Kernel Architect


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



More information about the Ecos-discuss mailing list