MCPcopy Create free account
hub / github.com/awslabs/snapchange / alloc_shellcode

Method alloc_shellcode

examples/04_syscall_fuzzer/fuzzer.rs:277–290  ·  view source on GitHub ↗

Allocate a shellcode address

(&mut self, len: usize)

Source from the content-addressed store, hash-verified

275
276 /// Allocate a shellcode address
277 fn alloc_shellcode(&mut self, len: usize) -> Result<u64> {
278 if self.shellcode_offset >= SHELLCODE_LENGTH {
279 return Err(FuzzerError::ShellcodeOutOfMemory.into());
280 }
281
282 // Get the current shellcode address
283 let res = SHELLCODE + self.shellcode_offset;
284
285 // Update the bump allocator
286 self.shellcode_offset += len as u64;
287
288 // Return the shellcode address
289 Ok(res)
290 }
291
292 /// Write `bytes` into a scratch memory allocation and return the address of the
293 /// written to memory

Callers 1

write_shellcodeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected