2 releases
0.1.1 | Apr 11, 2023 |
---|---|
0.1.0 | Apr 11, 2023 |
#188 in #replace
21 downloads per month
6KB
104 lines
example replace argv[0] in stack
int main(int argc, char *argv[]){
argv[0] = "[new_name]";
return 0;
}
use stack_replace::ReplaceStack;
fn main() {
let args = std::env::args();
let args_str = args.collect::<Vec<String>>();
let st = ReplaceStack::new().unwrap();
let argv_addr = st.find_string_addr(&args_str[0]).unwrap();
println!("argv: {:?}", argv_addr);
for addr in argv_addr {
ReplaceStack::replace_string(addr, "[new_name]");
}
}