diff --git a/storagehandler.cpp b/storagehandler.cpp
index 929f3b6..65497b2 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -15,6 +15,7 @@
 #include <algorithm>
 #include <chrono>
 #include <cstdio>
+#include <cstring>
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/log.hpp>
 #include <sdbusplus/server.hpp>
@@ -145,7 +146,7 @@
         }
     }
 
-    memcpy(response, outPayload.data(), outPayload.size());
+    std::memcpy(response, outPayload.data(), outPayload.size());
     *data_len = outPayload.size();
 
     return IPMI_CC_OK;
@@ -239,7 +240,7 @@
 
     if (requestData->readLength == ipmi::sel::entireRecord)
     {
-        memcpy(response, &record, sizeof(record));
+        std::memcpy(response, &record, sizeof(record));
         *data_len = sizeof(record);
     }
     else
@@ -255,9 +256,11 @@
         auto readLength =
             std::min(diff, static_cast<int>(requestData->readLength));
 
-        memcpy(response, &record.nextRecordID, sizeof(record.nextRecordID));
-        memcpy(static_cast<uint8_t*>(response) + sizeof(record.nextRecordID),
-               &record.recordID + requestData->offset, readLength);
+        std::memcpy(response, &record.nextRecordID,
+                    sizeof(record.nextRecordID));
+        std::memcpy(static_cast<uint8_t*>(response) +
+                        sizeof(record.nextRecordID),
+                    &record.recordID + requestData->offset, readLength);
         *data_len = sizeof(record.nextRecordID) + readLength;
     }
 
@@ -352,7 +355,7 @@
 
     // Invalidate the cache of dbus entry objects.
     cache::paths.clear();
-    memcpy(response, &delRecordID, sizeof(delRecordID));
+    std::memcpy(response, &delRecordID, sizeof(delRecordID));
     *data_len = sizeof(delRecordID);
 
     return IPMI_CC_OK;
@@ -386,7 +389,7 @@
      */
     if (requestData->eraseOperation == ipmi::sel::getEraseStatus)
     {
-        memcpy(response, &eraseProgress, sizeof(eraseProgress));
+        std::memcpy(response, &eraseProgress, sizeof(eraseProgress));
         *data_len = sizeof(eraseProgress);
         return IPMI_CC_OK;
     }
@@ -407,7 +410,7 @@
         auto reply = bus.call(mapperCall);
         if (reply.is_method_error())
         {
-            memcpy(response, &eraseProgress, sizeof(eraseProgress));
+            std::memcpy(response, &eraseProgress, sizeof(eraseProgress));
             *data_len = sizeof(eraseProgress);
             return IPMI_CC_OK;
         }
@@ -415,14 +418,14 @@
         reply.read(objectPaths);
         if (objectPaths.empty())
         {
-            memcpy(response, &eraseProgress, sizeof(eraseProgress));
+            std::memcpy(response, &eraseProgress, sizeof(eraseProgress));
             *data_len = sizeof(eraseProgress);
             return IPMI_CC_OK;
         }
     }
     catch (const sdbusplus::exception::SdBusError& e)
     {
-        memcpy(response, &eraseProgress, sizeof(eraseProgress));
+        std::memcpy(response, &eraseProgress, sizeof(eraseProgress));
         *data_len = sizeof(eraseProgress);
         return IPMI_CC_OK;
     }
@@ -456,7 +459,7 @@
 
     // Invalidate the cache of dbus entry objects.
     cache::paths.clear();
-    memcpy(response, &eraseProgress, sizeof(eraseProgress));
+    std::memcpy(response, &eraseProgress, sizeof(eraseProgress));
     *data_len = sizeof(eraseProgress);
     return IPMI_CC_OK;
 }
@@ -518,7 +521,7 @@
     *data_len = sizeof(resp);
 
     // Pack the actual response
-    memcpy(response, &resp, *data_len);
+    std::memcpy(response, &resp, *data_len);
 
     return IPMI_CC_OK;
 }
@@ -587,7 +590,7 @@
     *data_len = sizeof(g_sel_reserve);
 
     // Pack the actual response
-    memcpy(response, &g_sel_reserve, *data_len);
+    std::memcpy(response, &g_sel_reserve, *data_len);
 
     return rc;
 }
@@ -608,7 +611,7 @@
     *data_len = sizeof(g_sel_reserve);
 
     // Pack the actual response
-    memcpy(response, &p->eventdata[1], 2);
+    std::memcpy(response, &p->eventdata[1], 2);
 
     // Hostboot sends SEL with OEM record type 0xDE to indicate that there is
     // a maintenance procedure associated with eSEL record.
@@ -655,7 +658,7 @@
         *data_len = sizeof(resp);
 
         // Pack the actual response
-        memcpy(response, &resp, *data_len);
+        std::memcpy(response, &resp, *data_len);
     }
     catch (const InternalFailure& e)
     {
@@ -730,7 +733,7 @@
     constexpr auto sdrVersion = 0x51;
     auto responseData = reinterpret_cast<GetRepositoryInfoResponse*>(response);
 
-    memset(responseData, 0, sizeof(GetRepositoryInfoResponse));
+    std::memset(responseData, 0, sizeof(GetRepositoryInfoResponse));
 
     responseData->sdrVersion = sdrVersion;
 
