clang-tidy: Enable cppcoreguidelines-pro-bounds

Modified code to address issues flagged by
cppcoreguidelines-pro-bounds-array-to-pointer-decay check.

Tested: Build and unit tests passed successfully.

Change-Id: I68f418d0dad440df685c103709589f6e78d141fb
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
diff --git a/.clang-tidy b/.clang-tidy
index 3ba856b..add6c76 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -243,6 +243,7 @@
 cppcoreguidelines-noexcept-move-operations,
 cppcoreguidelines-noexcept-swap,
 cppcoreguidelines-prefer-member-initializer,
+cppcoreguidelines-pro-bounds-array-to-pointer-decay,
 cppcoreguidelines-pro-type-const-cast,
 cppcoreguidelines-pro-type-static-cast-downcast,
 cppcoreguidelines-pro-type-union-access,
diff --git a/dump_offload.cpp b/dump_offload.cpp
index edf1bff..188f901 100644
--- a/dump_offload.cpp
+++ b/dump_offload.cpp
@@ -15,6 +15,7 @@
 #include <xyz/openbmc_project/Common/error.hpp>
 
 #include <fstream>
+#include <span>
 
 namespace phosphor
 {
@@ -102,8 +103,12 @@
             "UNIX socket path is too long " + std::string(strerror(errno));
         throw std::length_error(msg);
     }
-    strncpy(socketAddr.sun_path, sockPath.c_str(),
-            sizeof(socketAddr.sun_path) - 1);
+
+    std::span<char> sunPathSpan(reinterpret_cast<char*>(socketAddr.sun_path),
+                                sizeof(socketAddr.sun_path));
+    strncpy(sunPathSpan.data(), sockPath.c_str(), sunPathSpan.size() - 1);
+    sunPathSpan[sunPathSpan.size() - 1] = '\0'; // Ensure null-termination
+
     if ((unixSocket = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0)) == -1)
     {
         lg2::error("socketInit: socket() failed, errno: {ERRNO}", "ERRNO",
diff --git a/test/debug_inif_test.cpp b/test/debug_inif_test.cpp
index fb632dc..08cb2a7 100644
--- a/test/debug_inif_test.cpp
+++ b/test/debug_inif_test.cpp
@@ -5,6 +5,7 @@
 #include <exception>
 #include <filesystem>
 #include <set>
+#include <span>
 #include <string>
 
 #include <gtest/gtest.h>
@@ -19,7 +20,9 @@
     void SetUp()
     {
         char tmpdir[] = "/tmp/dump.XXXXXX";
-        auto dirPtr = mkdtemp(tmpdir);
+        std::span<char> tmpdirSpan(reinterpret_cast<char*>(tmpdir),
+                                   sizeof(tmpdir));
+        auto dirPtr = mkdtemp(tmpdirSpan.data());
         if (dirPtr == NULL)
         {
             throw std::bad_alloc();
diff --git a/watch.cpp b/watch.cpp
index 18c4dfd..35205da 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -5,6 +5,8 @@
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/lg2.hpp>
 
+#include <span>
+
 namespace phosphor
 {
 namespace dump
@@ -87,7 +89,8 @@
     constexpr auto maxBytes = sizeof(struct inotify_event) + NAME_MAX + 1;
     uint8_t buffer[maxBytes];
 
-    auto bytes = read(fd, buffer, maxBytes);
+    std::span<char> bufferSpan(reinterpret_cast<char*>(buffer), maxBytes);
+    auto bytes = read(fd, bufferSpan.data(), bufferSpan.size());
     if (0 > bytes)
     {
         // Failed to read inotify event