[coreboot] libpayload: Add LAR walking support

Peter Stuge peter at stuge.se
Sun Apr 27 02:08:08 CEST 2008


On Sat, Apr 26, 2008 at 09:17:26AM -0600, Jordan Crouse wrote:
> > How about input validation? It is done here in closelar() but not
> > in other functions.
> 
> I think you'll find that input validation happens in all of the API
> functions - I think thats sufficient.  The API functions should be
> able to verify that everything is good before sending them to the
> static helper functions.

Aha! Yes agreed.


> > > +	case SEEK_END:
> > > +		file->offset = file->size - offset;
> > > +		break;
> > 
> > Should this not be file->size + offset?
> 
> Yeah, but SEEK_END doesn't work anyway, so I changed it to return
> -1.

Oh, no, please bring it back.


> You can't seek past the end of a LAR.

A negative offset should work just fine though, and there is bounds
checking and adjustment before returning.


//Peter




More information about the coreboot mailing list