- Null terminate bytes if passed to Utf8String

This commit is contained in:
Infi
2026-04-19 21:18:47 +02:00
parent 69c890facb
commit 93faf1b5bd
3 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<Project Sdk="Dalamud.NET.Sdk/14.0.2"> <Project Sdk="Dalamud.NET.Sdk/14.0.2">
<PropertyGroup> <PropertyGroup>
<Version>1.34.6</Version> <Version>1.34.7</Version>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+3 -3
View File
@@ -468,7 +468,7 @@ internal sealed unsafe class Chat : IDisposable
internal void SendTellUsingCommandInner(byte[] message) internal void SendTellUsingCommandInner(byte[] message)
{ {
var mes = Utf8String.FromSequence(message); var mes = Utf8String.FromSequence(message.NullTerminate());
RaptureShellModule.Instance()->ExecuteCommandInner(mes, UIModule.Instance()); RaptureShellModule.Instance()->ExecuteCommandInner(mes, UIModule.Instance());
RaptureAtkModule.Instance()->ClearFocus(); // Clear the focus of vanilla chat that was still active RaptureAtkModule.Instance()->ClearFocus(); // Clear the focus of vanilla chat that was still active
@@ -486,13 +486,13 @@ internal sealed unsafe class Chat : IDisposable
} }
var uName = Utf8String.FromString(name); var uName = Utf8String.FromString(name);
var uMessage = Utf8String.FromSequence(message); var uMessage = Utf8String.FromSequence(message.NullTerminate());
var encoded = Utf8String.FromUtf8String(PronounModule.Instance()->ProcessString(uMessage, true)); var encoded = Utf8String.FromUtf8String(PronounModule.Instance()->ProcessString(uMessage, true));
var decoded = EncodeMessage(rawText); var decoded = EncodeMessage(rawText);
AutoTranslate.ReplaceWithPayload(ref decoded); AutoTranslate.ReplaceWithPayload(ref decoded);
using var decodedUtf8String = new Utf8String(decoded); using var decodedUtf8String = new Utf8String(decoded.NullTerminate());
var logModule = RaptureLogModule.Instance(); var logModule = RaptureLogModule.Instance();
var networkModule = Framework.Instance()->GetNetworkModuleProxy()->NetworkModule; var networkModule = Framework.Instance()->GetNetworkModuleProxy()->NetworkModule;
+2 -1
View File
@@ -1,4 +1,5 @@
using System.Text; using System.Text;
using Dalamud.Memory;
using FFXIVClientStructs.FFXIV.Client.System.String; using FFXIVClientStructs.FFXIV.Client.System.String;
using FFXIVClientStructs.FFXIV.Client.UI; using FFXIVClientStructs.FFXIV.Client.UI;
@@ -8,7 +9,7 @@ public unsafe class ChatBox
{ {
public static void SendMessageUnsafe(byte[] message) public static void SendMessageUnsafe(byte[] message)
{ {
var mes = Utf8String.FromSequence(message); var mes = Utf8String.FromSequence(message.NullTerminate());
UIModule.Instance()->ProcessChatBoxEntry(mes); UIModule.Instance()->ProcessChatBoxEntry(mes);
mes->Dtor(true); mes->Dtor(true);
} }