Bug 879924 - Don't shorten zero-length strings. r=derf

We were trying to strip the optional null terminator
even when we knew there wasn't one there.
This commit is contained in:
Ralph Giles 2013-06-10 17:10:09 -07:00
parent a07587452c
commit d09bd7d346

View File

@ -579,8 +579,10 @@ WaveReader::LoadListChunk(uint32_t aChunkSize,
break;
}
// Wrap the string, adjusting length to account for optional
// null termination in the chunk.
nsCString val(p, length);
if (val[length - 1] == '\0') {
if (length > 0 && val[length - 1] == '\0') {
val.SetLength(length - 1);
}