One of the first things one learns about Rust is that one has to go out of ones way to create buffer overruns and such memory use errors in Rust. Indeed that is, too a large part, why one is interest in Rust in the first place. How did you miss this major fact?
If you really want to I guess creating a security vulnerability by leaking data could be done quite easily.
- Your program defines a nice big vector as buffer for data traveling through the system.
let buffer: Vec<u8> = vec!;
Somewhere your program reads user input into that buffer, including passwords, keys, whatever secret stuff. The input data does not fill the buffer.
Somewhere your program outputs that data, perhaps as a slice.
What if the size of that slice being output is bigger than the amount of data the user input? Now you are outputting some unknown junk at the end of the buffer?
What if that unknown junk is actually the password, key, secret stuff from some previous user whose data passed through that buffer?
I have already done something like that when reading/writing to a serial port. I was getting a lot of junk in my serial output till I realized I was outputting an entire buffer rather than a slice of the correct length.
I'm sure someone here could craft a good example.