Commit 9032fdbc authored by David Reid's avatar David Reid

Try fixing a null termination bug in ma_channel_map_to_string().

Public issue https://github.com/mackron/miniaudio/issues/980
parent 2ee92057
......@@ -56458,8 +56458,12 @@ MA_API size_t ma_channel_map_to_string(const ma_channel* pChannelMap, ma_uint32
}
/* Null terminate. Don't increment the length here. */
if (pBufferOut != NULL && bufferCap > len + 1) {
pBufferOut[len] = '\0';
if (pBufferOut != NULL) {
if (bufferCap > len) {
pBufferOut[len] = '\0';
} else if (bufferCap > 0) {
pBufferOut[bufferCap - 1] = '\0';
}
}
return len;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment