[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Security in a shell that starts ssh



On 13-Jun-01, 11:24 (CDT), Daniel Ginsburg <dg@warpsolutions.com> wrote: 
> >
> >      if(name[strlen(name) - 1] != '\n') {
> >
> 
> Possible access to unallocated memory if "\0\n" supplied as input.

Oops, didn't catch that one.

> > >   /* return 0; */
> > 
> >     exit(EXIT_SUCCESS); /* return doesn't call atexit() registered functions,
> >                            which doesn't apply in this case, but it's a good
> >                            habit to get into */
> >
> 
> Wrong comment. Returning from main _does_ call atexit() registered
> functions.

[Steve pulls brown-paper bag over head]

Right. I knew that. That's what I get for taking a quick glance at the
wrong book instead trusting my memory or looking in the standard. I'd
still argue that exit(_macro_) is better style than return from main(),
but I'm hard pressed to find a technical argument.

> Spaces and other shell metacharecters are irrelevant in this case, since
> executed command won't undergo shell interpretation.

Hmmm, right. I should have tried it. This is the kind of thing (rigorous
input validation) one needs to think about when doing security conscious
programming, though.

Steve
-- 
Steve Greenland <stevegr@debian.org>
(Please do not CC me on mail sent to this list; I subscribe to and read
every list I post to.)



Reply to: