mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
nsDependentCString must be null-terminated, but byte buffers do not. temporary fix until we start using a "real" byte buffer
This commit is contained in:
parent
a0cb461b15
commit
f1b7dc69e2
@ -556,11 +556,19 @@ _posturlnotify(NPP aNPP,
|
||||
|
||||
nsCString url = NullableString(aRelativeURL);
|
||||
NPError err;
|
||||
|
||||
// FIXME what should happen when |aBuffer| is null?
|
||||
|
||||
// FIXME bad hack around using nsDependentCString when we really
|
||||
// want a real byte buffer
|
||||
nsAutoPtr<char> bufferCopy(new char[aLength+1]);
|
||||
memcpy(bufferCopy, aBuffer, aLength);
|
||||
bufferCopy[aLength] = 0;
|
||||
|
||||
InstCast(aNPP)->CallPStreamNotifyConstructor(
|
||||
new StreamNotifyChild(url, aNotifyData),
|
||||
url, NullableString(aTarget), true,
|
||||
nsDependentCString(aBuffer, aLength), aIsFile, &err);
|
||||
nsDependentCString(bufferCopy, aLength), aIsFile, &err);
|
||||
// TODO: what if this fails?
|
||||
return err;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user