void*c=mmap(NULL,32,PROT_READ|PROT_WRITE|PROT_EXEC,MAP_PRIVATE|MAP_ANON,-1,0);// expected-warning{{Both PROT_WRITE and PROT_EXEC flags are set. This can lead to exploitable memory regions, which could be overwritten with malicious code}}
(void)a;
(void)b;
(void)c;
}
voidf2()
{
void*(*callm)(void*,size_t,int,int,int,long);
callm=mmap;
intprot=PROT_WRITE|PROT_EXEC;
(void)callm(NULL,1024,prot,MAP_PRIVATE|MAP_ANON,-1,0);// expected-warning{{Both PROT_WRITE and PROT_EXEC flags are set. This can lead to exploitable memory regions, which could be overwritten with malicious code}}
intm=mprotect(p,1024,PROT_WRITE|PROT_EXEC);// expected-warning{{Both PROT_WRITE and PROT_EXEC flags are set. This can lead to exploitable memory regions, which could be overwritten with malicious code}}