Try fixing a null termination bug in ma_channel_map_to_string().

Public issue https://github.com/mackron/miniaudio/issues/980
This commit is contained in:
David Reid
2025-04-25 18:58:01 +10:00
parent 2ee920577e
commit 9032fdbced
+5 -1
View File
@@ -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) {
if (pBufferOut != NULL) {
if (bufferCap > len) {
pBufferOut[len] = '\0';
} else if (bufferCap > 0) {
pBufferOut[bufferCap - 1] = '\0';
}
}
return len;