1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-09 06:15:49 +02:00

Fix large notification HTML overflowing CEF buffer and silently crashing

This commit is contained in:
chylex 2020-06-02 04:05:29 +02:00
parent 1bf9e7fb56
commit 4c61047e9b

View File

@ -1,4 +1,5 @@
using System.Collections.Specialized;
using System;
using System.Collections.Specialized;
using System.IO;
using System.Text;
using CefSharp;
@ -39,9 +40,11 @@ bool IResourceHandler.ReadResponse(Stream dataOut, out int bytesRead, ICallback
callback.Dispose();
try{
int length = (int)dataIn.Length;
byte[] buffer = new byte[Math.Min(dataIn.Length, dataOut.Length)];
int length = buffer.Length;
dataIn.CopyTo(dataOut, length);
dataIn.Read(buffer, 0, length);
dataOut.Write(buffer, 0, length);
bytesRead = length;
return true;
}catch{ // catch IOException, possibly NullReferenceException if dataIn is null