Date: Wed, 31 Jan 2007 19:04:31 GMT From: "Christian S.J. Peron" <csjp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 113783 for review Message-ID: <200701311904.l0VJ4Vmu095038@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113783 Change 113783 by csjp@csjp_rnd01 on 2007/01/31 19:04:17 use malloc buffer instead of stack allocated storage Affected files ... .. //depot/projects/zcopybpf/utils/bpfnull/bpfnull.c#4 edit Differences ... ==== //depot/projects/zcopybpf/utils/bpfnull/bpfnull.c#4 (text+ko) ==== @@ -83,9 +83,12 @@ { fd_set s_set, r_set; struct bpf_zbuf bz; - char pbuf[65535]; + char *pbuf; int n; + pbuf = malloc(bflag + 1); + if (pbuf == NULL) + err(1, "malloc"); FD_SET(fd, &s_set); for (;;) { r_set = s_set; @@ -98,10 +101,10 @@ (void) fprintf(stderr, "DEBUG: wokeup and bpf is ready to read from\n"); if (zflag == 0) { - n = read(fd, &pbuf[0], bflag); + n = read(fd, pbuf, bflag); if (n < 0) err(1, "read failed"); - bz.bz_bufa = &pbuf[0]; + bz.bz_bufa = pbuf; bz.bz_buflen = n; } else if (ioctl(fd, BIOCGETZNEXT, &bz) < 0)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701311904.l0VJ4Vmu095038>