From 72245fc6c3f883e1a05400a7b603aa8fb6a8e4e3 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Tue, 10 Aug 2021 08:45:14 -0400 Subject: [PATCH] Ensure ndof product string is null terminate --- indra/newview/llviewerjoystick.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/indra/newview/llviewerjoystick.cpp b/indra/newview/llviewerjoystick.cpp index df177adb7b2..de4ac848ca3 100644 --- a/indra/newview/llviewerjoystick.cpp +++ b/indra/newview/llviewerjoystick.cpp @@ -475,7 +475,10 @@ void LLViewerJoystick::initDevice(void * preffered_device /*LPDIRECTINPUTDEVICE8 #if LIB_NDOF mLastDeviceUUID = guid; - strncpy(mNdofDev->product, name.c_str(), sizeof(mNdofDev->product)); + size_t dest_size = sizeof(mNdofDev->product); + strncpy(mNdofDev->product, name.c_str(), dest_size-1); + mNdofDev->product[dest_size] = '\0'; + mNdofDev->manufacturer[0] = '\0'; initDevice(preffered_device); -- GitLab