PortMidi / portmidi

portmidi is a cross-platform MIDI input/output library
Other
116 stars 31 forks source link

PmDeviceInfo::name non const without lenght constains. #41

Closed daschuer closed 1 year ago

daschuer commented 1 year ago

What was the reason for making PmDeviceInfo::name non const here: https://github.com/PortMidi/portmidi/blob/103beb136ca9833d47d3f3a150364330d78638e7/pm_common/portmidi.h#L222

We use it in Mixxx here: https://github.com/mixxxdj/mixxx/blob/main/src/test/portmidicontroller_test.cpp#L69 And after upgrade, compiling fails because we path a sting literal.

If anything in PortMidi wants to write the string, it needs to know the length, to not overwrite the buffer boundaries. Is this the case? how big needs the buffer to be?

daschuer commented 1 year ago

OK, i got it. Normally the memory is maintained by Pm_GetDeviceInfo() and it is not intended to touch it. The issue in Mixxx is sourced by testing code that simulates this behavior. This is not an issue.