RustAudio / vst-rs

VST 2.4 API implementation in rust. Create plugins or hosts. Previously rust-vst on the RustDSP group.
MIT License
1.04k stars 91 forks source link

Garbage param/preset/... names when maximum string size reached #196

Open helgoboss opened 1 year ago

helgoboss commented 1 year ago

This is caused by a bug in the copy_string function that can cause a missing nul terminator:

https://github.com/RustAudio/vst-rs/blob/ab74a5682df4fc08e1f78a28fac12aad1ff5fe0b/src/interfaces.rs#L76

It should be max - 1, otherwise the nul terminator set by the previous statement will be overwritten and the C string becomes open-ended ... undefined behavior when the DAW reads this!

I'm aware that usage of this project is deprecated but I think there are still some plug-ins out there using it, so hope this helps.