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]

Re: cyg_mtab_lookup()


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


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