mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-21 15:56:58 +02:00
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:
+5
-1
@@ -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. */
|
/* Null terminate. Don't increment the length here. */
|
||||||
if (pBufferOut != NULL && bufferCap > len + 1) {
|
if (pBufferOut != NULL) {
|
||||||
|
if (bufferCap > len) {
|
||||||
pBufferOut[len] = '\0';
|
pBufferOut[len] = '\0';
|
||||||
|
} else if (bufferCap > 0) {
|
||||||
|
pBufferOut[bufferCap - 1] = '\0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
|
|||||||
Reference in New Issue
Block a user