[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] whois, new applet
From:       Dan Fandrich <dan () coneharvesters ! com>
Date:       2011-02-28 18:46:28
Message-ID: 20110228184626.GA2992 () coneharvesters ! com
[Download RAW message or body]

On Mon, Feb 28, 2011 at 02:22:08PM +0100, walter harms wrote:
> Am 27.02.2011 23:40, schrieb Denys Vlasenko:
> > static void pipe_out(int fd)
> > {
> >         FILE *fp;
> >         char buf[1024];
> > 
> >         fp = xfdopen_for_read(fd);
> >         while (fgets(buf, sizeof(buf), fp)) {
> >                 char *p = strpbrk(buf, "\r\n");
> >                 if (p)
> >                         *p = '\0';
> >                 puts(buf);
> >         }
> > 
> >         fclose(fp); /* closes fd too */
> > }
> > 
> 
> perhaps we can use xmalloc_fgetline() here ?
> that would avoid having a fixed buffer.

That opens the code up to a remote DOS attack, whereby the remote could send
an infinitely-long string (e.g. chargen) and use up all available RAM.

>>> Dan
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic