| Summary: | getty(8) didn't check if if= isn't empty | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | Cyrille Lefevre <clefevre> | ||||
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
| Status: | Open --- | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 4.3-STABLE | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
|
Description
Cyrille Lefevre
2001-05-10 23:00:00 UTC
On Thu, 10 May 2001, Cyrille Lefevre wrote:
> >Description:
>
> all is in the subject. this is not so important, but be safe.
>
> >How-To-Repeat:
>
> :if=: in gettytab
>
> >Fix:
>
> Index: main.c
> ===================================================================
> RCS file: /home/ncvs/src/libexec/getty/main.c,v
> retrieving revision 1.28.2.2
> diff -u -r1.28.2.2 main.c
> --- main.c 2001/03/05 11:17:08 1.28.2.2
> +++ main.c 2001/03/11 06:02:46
> @@ -324,7 +324,7 @@
>
> /* if this is the first time through this, and an
> issue file has been given, then send it */
> - if (first_time && IF) {
> + if (first_time && IF && *IF) {
> int fd;
>
> if ((fd = open(IF, O_RDONLY)) != -1) {
This is safer than `:if=/bin/sh:'. It just causes the open to fail
just like for any other nonexistent file (POSIX standard).
Bruce
Bruce Evans <bde@zeta.org.au> writes: [snip] > > - if (first_time && IF) { > > + if (first_time && IF && *IF) { > > int fd; > > > > if ((fd = open(IF, O_RDONLY)) != -1) { > > This is safer than `:if=/bin/sh:'. It just causes the open to fail > just like for any other nonexistent file (POSIX standard). yes, but this syscall isn't needed, so, why not to get rid of it if if= is empty ? Cyrille. -- home: mailto:clefevre@poboxes.com UNIX is user-friendly; it's just particular work: mailto:Cyrille.Lefevre@edf.fr about who it chooses to be friends with. On 14 May 2001, Cyrille Lefevre wrote:
> Bruce Evans <bde@zeta.org.au> writes:
>
> [snip]
> > > - if (first_time && IF) {
> > > + if (first_time && IF && *IF) {
> > > int fd;
> > >
> > > if ((fd = open(IF, O_RDONLY)) != -1) {
> >
> > This is safer than `:if=/bin/sh:'. It just causes the open to fail
> > just like for any other nonexistent file (POSIX standard).
>
> yes, but this syscall isn't needed, so, why not to get rid of it if
> if= is empty ?
It takes more code, and takes longer in the usual case.
Bruce
Bruce Evans <bde@zeta.org.au> writes: > On 14 May 2001, Cyrille Lefevre wrote: > > > Bruce Evans <bde@zeta.org.au> writes: > > > > [snip] > > > > - if (first_time && IF) { > > > > + if (first_time && IF && *IF) { > > > > int fd; > > > > > > > > if ((fd = open(IF, O_RDONLY)) != -1) { > > > > > > This is safer than `:if=/bin/sh:'. It just causes the open to fail > > > just like for any other nonexistent file (POSIX standard). > > > > yes, but this syscall isn't needed, so, why not to get rid of it if > > if= is empty ? > > It takes more code, and takes longer in the usual case. are you joking ? a syscall faster than a simple test like this ? Cyrille. -- home: mailto:clefevre@poboxes.com UNIX is user-friendly; it's just particular work: mailto:Cyrille.Lefevre@edf.fr about who it chooses to be friends with. On 15 May 2001, Cyrille Lefevre wrote:
> Bruce Evans <bde@zeta.org.au> writes:
>
> > On 14 May 2001, Cyrille Lefevre wrote:
> >
> > > Bruce Evans <bde@zeta.org.au> writes:
> > >
> > > [snip]
> > > > > - if (first_time && IF) {
> > > > > + if (first_time && IF && *IF) {
> > > > > int fd;
> > > > >
> > > > > if ((fd = open(IF, O_RDONLY)) != -1) {
> > > >
> > > > This is safer than `:if=/bin/sh:'. It just causes the open to fail
> > > > just like for any other nonexistent file (POSIX standard).
> > >
> > > yes, but this syscall isn't needed, so, why not to get rid of it if
> > > if= is empty ?
> >
> > It takes more code, and takes longer in the usual case.
>
> are you joking ? a syscall faster than a simple test like this ?
No. The null test is faster than a simple test.
Bruce
anyone to commit this PR which is a one line patch ! thanks in advance. Cyrille Lefevre. -- home: mailto:cyrille.lefevre@laposte.net For bugs matching the following criteria: Status: In Progress Changed: (is less than) 2014-06-01 Reset to default assignee and clear in-progress tags. Mail being skipped |