From c20cea118b2f045cd1b057aac766ac8c0c64eb6c Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Thu, 19 Jul 2018 23:04:25 -0400
Subject: [PATCH 1/2] audout_u: Use a std::array instead of std::string for
 holding the audio interface name

Uses a type that doesn't potentially dynamically allocate, and ensures
that the name of the interface is properly null-terminated when writing
it to the buffer.
---
 src/core/hle/service/audio/audout_u.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index 4217ea4fb..154bc12da 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -2,6 +2,7 @@
 // Licensed under GPLv2 or any later version
 // Refer to the license.txt file included.
 
+#include <array>
 #include <vector>
 #include "common/logging/log.h"
 #include "core/core_timing.h"
@@ -167,7 +168,7 @@ void AudOutU::ListAudioOutsImpl(Kernel::HLERequestContext& ctx) {
     LOG_WARNING(Service_Audio, "(STUBBED) called");
     IPC::RequestParser rp{ctx};
 
-    const std::string audio_interface = "AudioInterface";
+    constexpr std::array<char, 15> audio_interface{{"AudioInterface"}};
     ctx.WriteBuffer(audio_interface);
 
     IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0);

From 40c9c5a55c7c9e00d96f55b1cd898a51120451fe Mon Sep 17 00:00:00 2001
From: Lioncash <mathew1800@gmail.com>
Date: Thu, 19 Jul 2018 23:09:35 -0400
Subject: [PATCH 2/2] audren_u: Use a std::array instead of std::string for
 holding the audio interface/device name

std::string doesn't include the null-terminator in its data() + size()
range. This ensures that the null-terminator will also be written to the buffer
---
 src/core/hle/service/audio/audren_u.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index 6903f52d6..e623f4f8e 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -2,6 +2,8 @@
 // Licensed under GPLv2 or any later version
 // Refer to the license.txt file included.
 
+#include <array>
+
 #include "common/alignment.h"
 #include "common/logging/log.h"
 #include "core/core_timing.h"
@@ -298,7 +300,7 @@ private:
         LOG_WARNING(Service_Audio, "(STUBBED) called");
         IPC::RequestParser rp{ctx};
 
-        const std::string audio_interface = "AudioInterface";
+        constexpr std::array<char, 15> audio_interface{{"AudioInterface"}};
         ctx.WriteBuffer(audio_interface);
 
         IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0);
@@ -323,7 +325,7 @@ private:
         LOG_WARNING(Service_Audio, "(STUBBED) called");
         IPC::RequestParser rp{ctx};
 
-        const std::string audio_interface = "AudioDevice";
+        constexpr std::array<char, 12> audio_interface{{"AudioDevice"}};
         ctx.WriteBuffer(audio_interface);
 
         IPC::ResponseBuilder rb = rp.MakeBuilder(3, 0, 0);