jirihybek / unity-websocket-webgl

Hybrid WebSocket implementation for Unity 3D with support of native and browser client.
Other
248 stars 61 forks source link

Missing byte in allocated string in instance.ws.onerror #15

Open gorylpe opened 3 years ago

gorylpe commented 3 years ago
var msg = "WebSocket error.";
var msgBytes = lengthBytesUTF8(msg);
var msgBuffer = _malloc(msgBytes + 1);
stringToUTF8(msg, msgBuffer, msgBytes);

should be

var msg = "WebSocket error.";
var msgBytes = lengthBytesUTF8(msg) + 1;
var msgBuffer = _malloc(msgBytes);
stringToUTF8(msg, msgBuffer, msgBytes);