Allocate a shellcode address
(&mut self, len: usize)
| 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 |