diff --git a/apphandler.cpp b/apphandler.cpp
index ab5c604..cbbd5f4 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -325,7 +325,7 @@
 
             rev.minor = (rev.minor > 99 ? 99 : rev.minor);
             dev_id.fw[1] = rev.minor % 10 + (rev.minor / 10) * 16;
-            memcpy(&dev_id.aux, rev.d, 4);
+            std::memcpy(&dev_id.aux, rev.d, 4);
         }
 
         // IPMI Spec version 2.0
@@ -374,7 +374,7 @@
     }
 
     // Pack the actual response
-    memcpy(response, &dev_id, *data_len);
+    std::memcpy(response, &dev_id, *data_len);
 
     return rc;
 }
@@ -415,7 +415,7 @@
     selftestresults[0] = 0x56;
     selftestresults[1] = 0;
 
-    memcpy(response, selftestresults, *data_len);
+    std::memcpy(response, selftestresults, *data_len);
 
     return rc;
 }
@@ -503,7 +503,7 @@
 
             int resp_byte = strtoul(tmp_array, NULL, 16); // Convert to hex byte
             // Copy end to first
-            memcpy((void*)&resp_uuid[resp_loc], &resp_byte, 1);
+            std::memcpy((void*)&resp_uuid[resp_loc], &resp_byte, 1);
             resp_loc--;
             id_octet += 2; // Finished with the 2 chars, advance
         }
@@ -514,7 +514,7 @@
     *data_len = resp_size;
 
     // Pack the actual response
-    memcpy(response, &resp_uuid, *data_len);
+    std::memcpy(response, &resp_uuid, *data_len);
 
 finish:
     sd_bus_error_free(&error);
@@ -543,7 +543,7 @@
     *data_len = sizeof(str);
 
     // Pack the actual response
-    memcpy(response, &str, *data_len);
+    std::memcpy(response, &str, *data_len);
 
     return rc;
 }
@@ -560,7 +560,7 @@
     *data_len = strlen("THIS IS WILDCARD");
 
     // Now pack actual response
-    memcpy(response, "THIS IS WILDCARD", *data_len);
+    std::memcpy(response, "THIS IS WILDCARD", *data_len);
 
     return rc;
 }
@@ -619,7 +619,7 @@
         }
 
         *data_len = bmc_guid_len;
-        memcpy(response, &respGuid, bmc_guid_len);
+        std::memcpy(response, &respGuid, bmc_guid_len);
     }
     catch (const InternalFailure& e)
     {
diff --git a/chassishandler.cpp b/chassishandler.cpp
index b822212..dab62c4 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -17,6 +17,7 @@
 
 #include <array>
 #include <chrono>
+#include <cstring>
 #include <fstream>
 #include <future>
 #include <map>
@@ -372,7 +373,7 @@
         // don't send blank override.
         if ((MACAddress == ipmi::network::DEFAULT_MAC_ADDRESS))
         {
-            memset(respptr->data, 0, SIZE_BOOT_OPTION);
+            std::memset(respptr->data, 0, SIZE_BOOT_OPTION);
             rc = -1;
             return rc;
         }
@@ -383,7 +384,7 @@
             if ((ipAddress == ipmi::network::DEFAULT_ADDRESS) ||
                 (gateway == ipmi::network::DEFAULT_ADDRESS) || (!prefix))
             {
-                memset(respptr->data, 0, SIZE_BOOT_OPTION);
+                std::memset(respptr->data, 0, SIZE_BOOT_OPTION);
                 rc = -1;
                 return rc;
             }
@@ -397,7 +398,8 @@
 
         respptr->data[MAC_OFFSET + 6] = 0x00;
 
-        memcpy(respptr->data + ADDRTYPE_OFFSET, &isStatic, sizeof(isStatic));
+        std::memcpy(respptr->data + ADDRTYPE_OFFSET, &isStatic,
+                    sizeof(isStatic));
 
         uint8_t addressFamily = (properties["Type"].get<std::string>() ==
                                  "xyz.openbmc_project.Network.IP.Protocol.IPv4")
@@ -414,7 +416,7 @@
 
         uint8_t prefixOffset = IPADDR_OFFSET + addrSize;
 
-        memcpy(respptr->data + prefixOffset, &prefix, sizeof(prefix));
+        std::memcpy(respptr->data + prefixOffset, &prefix, sizeof(prefix));
 
         uint8_t gatewayOffset = prefixOffset + sizeof(decltype(prefix));
 
@@ -424,24 +426,24 @@
     catch (InternalFailure& e)
     {
         commit<InternalFailure>();
-        memset(respptr->data, 0, SIZE_BOOT_OPTION);
+        std::memset(respptr->data, 0, SIZE_BOOT_OPTION);
         rc = -1;
         return rc;
     }
 
     // PetiBoot-Specific
     // If success then copy the first 9 bytes to the data
-    memcpy(respptr->data, net_conf_initial_bytes,
-           sizeof(net_conf_initial_bytes));
+    std::memcpy(respptr->data, net_conf_initial_bytes,
+                sizeof(net_conf_initial_bytes));
 
-    memcpy(respptr->data + ADDR_SIZE_OFFSET, &addrSize, sizeof(addrSize));
+    std::memcpy(respptr->data + ADDR_SIZE_OFFSET, &addrSize, sizeof(addrSize));
 
 #ifdef _IPMI_DEBUG_
-    printf("\n===Printing the IPMI Formatted Data========\n");
+    std::printf("\n===Printing the IPMI Formatted Data========\n");
 
     for (uint8_t pos = 0; pos < index; pos++)
     {
-        printf("%02x ", respptr->data[pos]);
+        std::printf("%02x ", respptr->data[pos]);
     }
 #endif
 
@@ -468,7 +470,7 @@
             struct sockaddr_in addr4
             {
             };
-            memcpy(&addr4.sin_addr.s_addr, &data[offset], addrSize);
+            std::memcpy(&addr4.sin_addr.s_addr, &data[offset], addrSize);
 
             inet_ntop(AF_INET, &addr4.sin_addr, ipAddr, INET_ADDRSTRLEN);
 
@@ -479,7 +481,7 @@
             struct sockaddr_in6 addr6
             {
             };
-            memcpy(&addr6.sin6_addr.s6_addr, &data[offset], addrSize);
+            std::memcpy(&addr6.sin6_addr.s6_addr, &data[offset], addrSize);
 
             inet_ntop(AF_INET6, &addr6.sin6_addr, ipAddr, INET6_ADDRSTRLEN);
 
@@ -543,14 +545,14 @@
                 elog<InternalFailure>();
             }
 
-            snprintf(mac, SIZE_MAC, ipmi::network::MAC_ADDRESS_FORMAT,
-                     reqptr->data[MAC_OFFSET], reqptr->data[MAC_OFFSET + 1],
-                     reqptr->data[MAC_OFFSET + 2], reqptr->data[MAC_OFFSET + 3],
-                     reqptr->data[MAC_OFFSET + 4],
-                     reqptr->data[MAC_OFFSET + 5]);
+            std::snprintf(
+                mac, SIZE_MAC, ipmi::network::MAC_ADDRESS_FORMAT,
+                reqptr->data[MAC_OFFSET], reqptr->data[MAC_OFFSET + 1],
+                reqptr->data[MAC_OFFSET + 2], reqptr->data[MAC_OFFSET + 3],
+                reqptr->data[MAC_OFFSET + 4], reqptr->data[MAC_OFFSET + 5]);
 
-            memcpy(&addrOrigin, &(reqptr->data[ADDRTYPE_OFFSET]),
-                   sizeof(decltype(addrOrigin)));
+            std::memcpy(&addrOrigin, &(reqptr->data[ADDRTYPE_OFFSET]),
+                        sizeof(decltype(addrOrigin)));
 
             if (addrOrigin)
             {
@@ -559,13 +561,13 @@
             }
 
             // Get the address size
-            memcpy(&addrSize, &reqptr->data[ADDR_SIZE_OFFSET],
-                   sizeof(addrSize));
+            std::memcpy(&addrSize, &reqptr->data[ADDR_SIZE_OFFSET],
+                        sizeof(addrSize));
 
             uint8_t prefixOffset = IPADDR_OFFSET + addrSize;
 
-            memcpy(&prefix, &(reqptr->data[prefixOffset]),
-                   sizeof(decltype(prefix)));
+            std::memcpy(&prefix, &(reqptr->data[prefixOffset]),
+                        sizeof(decltype(prefix)));
 
             uint8_t gatewayOffset = prefixOffset + sizeof(decltype(prefix));
 
@@ -696,7 +698,7 @@
     // Chassis Bridge Device Address.
     chassis_cap.bridge_dev_addr = 0x20;
 
-    memcpy(response, &chassis_cap, *data_len);
+    std::memcpy(response, &chassis_cap, *data_len);
 
     return rc;
 }
@@ -928,7 +930,7 @@
     chassis_status.front_panel_button_cap_status = 0;
 
     // Pack the actual response
-    memcpy(response, &chassis_status, *data_len);
+    std::memcpy(response, &chassis_status, *data_len);
 
 finish:
     free(busname);
@@ -1327,7 +1329,7 @@
     get_sys_boot_options_t* reqptr = (get_sys_boot_options_t*)request;
     IpmiValue bootOption = ipmiDefault;
 
-    memset(resp, 0, sizeof(*resp));
+    std::memset(resp, 0, sizeof(*resp));
     resp->version = SET_PARM_VERSION;
     resp->parm = 5;
     resp->data[0] = SET_PARM_BOOT_FLAGS_VALID_ONE_TIME;
@@ -1461,8 +1463,8 @@
     ipmi_ret_t rc = IPMI_CC_OK;
     set_sys_boot_options_t* reqptr = (set_sys_boot_options_t*)request;
 
-    printf("IPMI SET_SYS_BOOT_OPTIONS reqptr->parameter =[%d]\n",
-           reqptr->parameter);
+    std::printf("IPMI SET_SYS_BOOT_OPTIONS reqptr->parameter =[%d]\n",
+                reqptr->parameter);
 
     // This IPMI command does not have any resposne data
     *data_len = 0;
diff --git a/groupext.cpp b/groupext.cpp
index c69d910..43656cd 100644
--- a/groupext.cpp
+++ b/groupext.cpp
@@ -2,6 +2,8 @@
 
 #include <host-ipmid/ipmid-api.h>
 
+#include <cstdio>
+
 #define GRPEXT_GET_GROUP_CMD 0
 void register_netfn_groupext_functions() __attribute__((constructor));
 
@@ -13,7 +15,7 @@
     ipmi_ret_t rc = IPMI_CC_OK;
     uint8_t* p = (uint8_t*)response;
 
-    printf("IPMI GROUP EXTENSIONS\n");
+    std::printf("IPMI GROUP EXTENSIONS\n");
 
     *data_len = 1;
     *p = 0;
diff --git a/ipmi_fru_info_area.cpp b/ipmi_fru_info_area.cpp
index 47979e9..949d546 100644
--- a/ipmi_fru_info_area.cpp
+++ b/ipmi_fru_info_area.cpp
@@ -5,6 +5,7 @@
 #include <map>
 #include <numeric>
 #include <phosphor-logging/elog.hpp>
+
 namespace ipmi
 {
 namespace fru
@@ -184,8 +185,8 @@
             std::copy(fru_raw, fru_raw + 3, std::back_inserter(data));
             return;
         }
-        fprintf(stderr, "MgfDate invalid date: %u secs since UNIX epoch\n",
-                static_cast<unsigned int>(raw));
+        std::fprintf(stderr, "MgfDate invalid date: %u secs since UNIX epoch\n",
+                     static_cast<unsigned int>(raw));
     }
     // Blank date
     data.emplace_back(0);
diff --git a/ipmid.cpp b/ipmid.cpp
index 207a5cf..bc6c522 100644
--- a/ipmid.cpp
+++ b/ipmid.cpp
@@ -16,6 +16,7 @@
 #include <unistd.h>
 
 #include <algorithm>
+#include <cstring>
 #include <host-ipmid/ipmid-host-cmd.hpp>
 #include <host-ipmid/oemrouter.hpp>
 #include <iostream>
@@ -56,11 +57,11 @@
 
 void print_usage(void)
 {
-    fprintf(stderr, "Options:  [-d mask]\n");
-    fprintf(stderr, "    mask : 0x01 - Print ipmi packets\n");
-    fprintf(stderr, "    mask : 0x02 - Print DBUS operations\n");
-    fprintf(stderr, "    mask : 0x04 - Print ipmi command details\n");
-    fprintf(stderr, "    mask : 0xFF - Print all trace\n");
+    std::fprintf(stderr, "Options:  [-d mask]\n");
+    std::fprintf(stderr, "    mask : 0x01 - Print ipmi packets\n");
+    std::fprintf(stderr, "    mask : 0x02 - Print DBUS operations\n");
+    std::fprintf(stderr, "    mask : 0x04 - Print ipmi command details\n");
+    std::fprintf(stderr, "    mask : 0xFF - Print all trace\n");
 }
 
 const char* DBUS_INTF = "org.openbmc.HostIpmi";
@@ -112,17 +113,17 @@
         /* print offset */
         if (i % HEXDUMP_COLS == 0)
         {
-            fprintf(s, "0x%06x: ", i);
+            std::fprintf(s, "0x%06x: ", i);
         }
 
         /* print hex data */
         if (i < len)
         {
-            fprintf(s, "%02x ", 0xFF & ((char*)mem)[i]);
+            std::fprintf(s, "%02x ", 0xFF & ((char*)mem)[i]);
         }
         else /* end of block, just aligning for ASCII dump */
         {
-            fprintf(s, "   ");
+            std::fprintf(s, "   ");
         }
 
         /* print ASCII dump */
@@ -132,18 +133,18 @@
             {
                 if (j >= len) /* end of block, not really printing */
                 {
-                    fputc(' ', s);
+                    std::fputc(' ', s);
                 }
-                else if (isprint(((char*)mem)[j])) /* printable char */
+                else if (std::isprint(((char*)mem)[j])) /* printable char */
                 {
-                    fputc(0xFF & ((char*)mem)[j], s);
+                    std::fputc(0xFF & ((char*)mem)[j], s);
                 }
                 else /* other char */
                 {
-                    fputc('.', s);
+                    std::fputc('.', s);
                 }
             }
-            fputc('\n', s);
+            std::fputc('\n', s);
         }
     }
 }
@@ -194,7 +195,7 @@
             log<level::ERR>("Net function not whitelisted",
                             entry("NETFN=0x%X", netfn), entry("CMD=0x%X", cmd));
             rc = IPMI_CC_INSUFFICIENT_PRIVILEGE;
-            memcpy(response, &rc, IPMI_CC_LEN);
+            std::memcpy(response, &rc, IPMI_CC_LEN);
             *data_len = IPMI_CC_LEN;
             return rc;
         }
@@ -223,7 +224,7 @@
                             entry("CMD=0x%X", IPMI_CMD_WILDCARD));
 
             // Respond with a 0xC1
-            memcpy(response, &rc, IPMI_CC_LEN);
+            std::memcpy(response, &rc, IPMI_CC_LEN);
             *data_len = IPMI_CC_LEN;
             return rc;
         }
@@ -262,7 +263,7 @@
     }
     // Now copy the return code that we got from handler and pack it in first
     // byte.
-    memcpy(response, &rc, IPMI_CC_LEN);
+    std::memcpy(response, &rc, IPMI_CC_LEN);
 
     // Data length is now actual data + completion code.
     *data_len = *data_len + IPMI_CC_LEN;
@@ -386,7 +387,7 @@
     size_t resplen = MAX_IPMI_BUFFER;
     unsigned char response[MAX_IPMI_BUFFER];
 
-    memset(response, 0, MAX_IPMI_BUFFER);
+    std::memset(response, 0, MAX_IPMI_BUFFER);
 
     r = sd_bus_message_read(m, "yyyy", &sequence, &netfn, &lun, &cmd);
     if (r < 0)
@@ -404,8 +405,9 @@
         return -1;
     }
 
-    fprintf(ipmiio, "IPMI Incoming: Seq 0x%02x, NetFn 0x%02x, CMD: 0x%02x \n",
-            sequence, netfn, cmd);
+    std::fprintf(ipmiio,
+                 "IPMI Incoming: Seq 0x%02x, NetFn 0x%02x, CMD: 0x%02x \n",
+                 sequence, netfn, cmd);
     hexdump(ipmiio, (void*)request, sz);
 
     // Allow the length field to be used for both input and output of the
@@ -429,7 +431,7 @@
         resplen = resplen - 1; // first byte is for return code.
     }
 
-    fprintf(ipmiio, "IPMI Response:\n");
+    std::fprintf(ipmiio, "IPMI Response:\n");
     hexdump(ipmiio, (void*)response, resplen);
 
     // Send the response buffer from the ipmi command
diff --git a/ipmisensor.cpp b/ipmisensor.cpp
index 8891cdb..9e88987 100644
--- a/ipmisensor.cpp
+++ b/ipmisensor.cpp
@@ -123,22 +123,26 @@
     {
 
         case 0x00:
-            snprintf(p, sizeof(valuestring), "POST Error, %s",
-                     event_data_lookup(g_fwprogress00h, pRec->event_data2));
+            std::snprintf(
+                p, sizeof(valuestring), "POST Error, %s",
+                event_data_lookup(g_fwprogress00h, pRec->event_data2));
             break;
         case 0x01: /* Using g_fwprogress02h for 0x01 because that's what the
                       ipmi spec says to do */
-            snprintf(p, sizeof(valuestring), "FW Hang, %s",
-                     event_data_lookup(g_fwprogress02h, pRec->event_data2));
+            std::snprintf(
+                p, sizeof(valuestring), "FW Hang, %s",
+                event_data_lookup(g_fwprogress02h, pRec->event_data2));
             break;
         case 0x02:
-            snprintf(p, sizeof(valuestring), "FW Progress, %s",
-                     event_data_lookup(g_fwprogress02h, pRec->event_data2));
+            std::snprintf(
+                p, sizeof(valuestring), "FW Progress, %s",
+                event_data_lookup(g_fwprogress02h, pRec->event_data2));
             break;
         default:
-            snprintf(p, sizeof(valuestring),
-                     "Internal warning, fw_progres offset unknown (0x%02x)",
-                     pTable->offset);
+            std::snprintf(
+                p, sizeof(valuestring),
+                "Internal warning, fw_progres offset unknown (0x%02x)",
+                pTable->offset);
             break;
     }
 
@@ -166,30 +170,32 @@
     {
 
         case 0x00:
-            snprintf(p, sizeof(valuestring), "System Reconfigured");
+            std::snprintf(p, sizeof(valuestring), "System Reconfigured");
             break;
         case 0x01:
-            snprintf(p, sizeof(valuestring), "OEM Boot Event");
+            std::snprintf(p, sizeof(valuestring), "OEM Boot Event");
             break;
         case 0x02:
-            snprintf(p, sizeof(valuestring),
-                     "Undetermined System Hardware Failure");
+            std::snprintf(p, sizeof(valuestring),
+                          "Undetermined System Hardware Failure");
             break;
         case 0x03:
-            snprintf(p, sizeof(valuestring),
-                     "System Failure see error log for more details (0x%02x)",
-                     pRec->event_data2);
+            std::snprintf(
+                p, sizeof(valuestring),
+                "System Failure see error log for more details (0x%02x)",
+                pRec->event_data2);
             break;
         case 0x04:
-            snprintf(
+            std::snprintf(
                 p, sizeof(valuestring),
                 "System Failure see PEF error log for more details (0x%02x)",
                 pRec->event_data2);
             break;
         default:
-            snprintf(p, sizeof(valuestring),
-                     "Internal warning, system_event offset unknown (0x%02x)",
-                     pTable->offset);
+            std::snprintf(
+                p, sizeof(valuestring),
+                "Internal warning, system_event offset unknown (0x%02x)",
+                pTable->offset);
             break;
     }
 
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 369a1a7..9792299 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -11,6 +11,7 @@
 
 #include <bitset>
 #include <cmath>
+#include <cstring>
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/log.hpp>
 #include <set>
@@ -99,8 +100,8 @@
     rc = get_bus_for_path(info.sensorPath.c_str(), &busname);
     if (rc < 0)
     {
-        fprintf(stderr, "Failed to get %s busname: %s\n",
-                info.sensorPath.c_str(), busname);
+        std::fprintf(stderr, "Failed to get %s busname: %s\n",
+                     info.sensorPath.c_str(), busname);
         goto final;
     }
 
@@ -134,16 +135,16 @@
     sd_bus_error error = SD_BUS_ERROR_NULL;
     sd_bus_message* m = NULL;
 
-    fprintf(ipmidbus,
-            "Attempting to set a dbus Variant Sensor 0x%02x via %s with a "
-            "value of %s\n",
-            number, method, value);
+    std::fprintf(ipmidbus,
+                 "Attempting to set a dbus Variant Sensor 0x%02x via %s with a "
+                 "value of %s\n",
+                 number, method, value);
 
     r = find_openbmc_path(number, &a);
 
     if (r < 0)
     {
-        fprintf(stderr, "Failed to find Sensor 0x%02x\n", number);
+        std::fprintf(stderr, "Failed to find Sensor 0x%02x\n", number);
         return 0;
     }
 
@@ -151,21 +152,23 @@
                                        method);
     if (r < 0)
     {
-        fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
+        std::fprintf(stderr, "Failed to create a method call: %s",
+                     strerror(-r));
         goto final;
     }
 
     r = sd_bus_message_append(m, "v", "s", value);
     if (r < 0)
     {
-        fprintf(stderr, "Failed to create a input parameter: %s", strerror(-r));
+        std::fprintf(stderr, "Failed to create a input parameter: %s",
+                     strerror(-r));
         goto final;
     }
 
     r = sd_bus_call(bus, m, 0, &error, NULL);
     if (r < 0)
     {
-        fprintf(stderr, "Failed to call the method: %s", strerror(-r));
+        std::fprintf(stderr, "Failed to call the method: %s", strerror(-r));
     }
 
 final:
@@ -183,16 +186,16 @@
     sd_bus_error error = SD_BUS_ERROR_NULL;
     sd_bus_message* m = NULL;
 
-    fprintf(ipmidbus,
-            "Attempting to set a dbus Variant Sensor 0x%02x via %s with a "
-            "value of 0x%02x\n",
-            number, method, value);
+    std::fprintf(ipmidbus,
+                 "Attempting to set a dbus Variant Sensor 0x%02x via %s with a "
+                 "value of 0x%02x\n",
+                 number, method, value);
 
     r = find_openbmc_path(number, &a);
 
     if (r < 0)
     {
-        fprintf(stderr, "Failed to find Sensor 0x%02x\n", number);
+        std::fprintf(stderr, "Failed to find Sensor 0x%02x\n", number);
         return 0;
     }
 
@@ -200,21 +203,23 @@
                                        method);
     if (r < 0)
     {
-        fprintf(stderr, "Failed to create a method call: %s", strerror(-r));
+        std::fprintf(stderr, "Failed to create a method call: %s",
+                     strerror(-r));
         goto final;
     }
 
     r = sd_bus_message_append(m, "v", "i", value);
     if (r < 0)
     {
-        fprintf(stderr, "Failed to create a input parameter: %s", strerror(-r));
+        std::fprintf(stderr, "Failed to create a input parameter: %s",
+                     strerror(-r));
         goto final;
     }
 
     r = sd_bus_call(bus, m, 0, &error, NULL);
     if (r < 0)
     {
-        fprintf(stderr, "12 Failed to call the method: %s", strerror(-r));
+        std::fprintf(stderr, "12 Failed to call the method: %s", strerror(-r));
     }
 
 final:
@@ -282,7 +287,7 @@
     r = find_openbmc_path(num, &dbus_if);
     if (r < 0)
     {
-        fprintf(stderr, "Could not find sensor %d\n", num);
+        std::fprintf(stderr, "Could not find sensor %d\n", num);
         return 0;
     }
     return get_type_from_interface(dbus_if);
@@ -312,7 +317,7 @@
     }
 
     *data_len = sizeof(buf);
-    memcpy(response, &buf, *data_len);
+    std::memcpy(response, &buf, *data_len);
 
     return rc;
 }
@@ -416,14 +421,14 @@
     {
         getResponse = iter->second.getFunc(iter->second);
         *data_len = getResponse.size();
-        memcpy(resp, getResponse.data(), *data_len);
+        std::memcpy(resp, getResponse.data(), *data_len);
         resp->operation = 1 << scanningEnabledBit;
         return IPMI_CC_OK;
     }
     catch (const std::exception& e)
     {
         *data_len = getResponse.size();
-        memcpy(resp, getResponse.data(), *data_len);
+        std::memcpy(resp, getResponse.data(), *data_len);
         return IPMI_CC_OK;
     }
 }
@@ -639,8 +644,8 @@
                 break;
             default:
                 // Cannot be hit.
-                fprintf(stderr, "Unknown value unit type: = %s\n",
-                        info->unit.c_str());
+                std::fprintf(stderr, "Unknown value unit type: = %s\n",
+                             info->unit.c_str());
         }
     }
     catch (sdbusplus::exception::InvalidEnumString e)
@@ -766,8 +771,9 @@
         return IPMI_CC_REQ_DATA_LEN_INVALID;
     }
 
-    memcpy(resp->record_data, reinterpret_cast<uint8_t*>(&record) + req->offset,
-           (dataLength));
+    std::memcpy(resp->record_data,
+                reinterpret_cast<uint8_t*>(&record) + req->offset,
+                (dataLength));
 
     *data_len = dataLength;
     *data_len += 2; // additional 2 bytes for next record ID
@@ -848,8 +854,8 @@
         }
 
         *data_len = sizeof(get_sdr::GetSdrResp) - req->offset;
-        memcpy(resp->record_data, (char*)&record + req->offset,
-               sizeof(get_sdr::SensorDataFullRecord) - req->offset);
+        std::memcpy(resp->record_data, (char*)&record + req->offset,
+                    sizeof(get_sdr::SensorDataFullRecord) - req->offset);
     }
 
     return ret;
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;
 
diff --git a/systemintfcmds.cpp b/systemintfcmds.cpp
index 5f5ac03..e0ff156 100644
--- a/systemintfcmds.cpp
+++ b/systemintfcmds.cpp
@@ -8,6 +8,7 @@
 #include <host-ipmid/ipmid-api.h>
 #include <mapper.h>
 
+#include <cstring>
 #include <host-ipmid/ipmid-host-cmd.hpp>
 
 void register_netfn_app_functions() __attribute__((constructor));
@@ -50,10 +51,10 @@
     oem_sel.data[0] = hostCmd.second;
 
     // All '0xFF' since unused.
-    memset(&oem_sel.data[1], 0xFF, 3);
+    std::memset(&oem_sel.data[1], 0xFF, 3);
 
     // Pack the actual response
-    memcpy(response, &oem_sel, *data_len);
+    std::memcpy(response, &oem_sel, *data_len);
     return rc;
 }
 
@@ -80,7 +81,7 @@
     *data_len = sizeof(set_event_msg_buffer_full);
 
     // Pack the actual response
-    memcpy(response, &set_event_msg_buffer_full, *data_len);
+    std::memcpy(response, &set_event_msg_buffer_full, *data_len);
 
     return rc;
 }
@@ -96,7 +97,7 @@
 
     // Event and message logging enabled by default so return for now
 #ifdef __IPMI_DEBUG__
-    printf("IPMI APP SET BMC GLOBAL ENABLES Ignoring for now\n");
+    std::printf("IPMI APP SET BMC GLOBAL ENABLES Ignoring for now\n");
 #endif
 
     return rc;
diff --git a/transporthandler.cpp b/transporthandler.cpp
index 1222d5a..43c88bb 100644
--- a/transporthandler.cpp
+++ b/transporthandler.cpp
@@ -176,12 +176,12 @@
                     auto ipsrc = dhcpEnabled ? ipmi::network::IPOrigin::DHCP
                                              : ipmi::network::IPOrigin::STATIC;
 
-                    memcpy(data, &ipsrc, ipmi::network::IPSRC_SIZE_BYTE);
+                    std::memcpy(data, &ipsrc, ipmi::network::IPSRC_SIZE_BYTE);
                 }
                 else if (channelConf->lan_set_in_progress == SET_IN_PROGRESS)
                 {
-                    memcpy(data, &(channelConf->ipsrc),
-                           ipmi::network::IPSRC_SIZE_BYTE);
+                    std::memcpy(data, &(channelConf->ipsrc),
+                                ipmi::network::IPSRC_SIZE_BYTE);
                 }
             }
             break;
@@ -211,7 +211,8 @@
                     {
                         // nothing to do
                     }
-                    memcpy(data, &mask, ipmi::network::IPV4_ADDRESS_SIZE_BYTE);
+                    std::memcpy(data, &mask,
+                                ipmi::network::IPV4_ADDRESS_SIZE_BYTE);
                 }
                 else if (channelConf->lan_set_in_progress == SET_IN_PROGRESS)
                 {
@@ -312,12 +313,12 @@
                         // nothing to do
                     }
 
-                    memcpy(data, &vlanID, ipmi::network::VLAN_SIZE_BYTE);
+                    std::memcpy(data, &vlanID, ipmi::network::VLAN_SIZE_BYTE);
                 }
                 else if (channelConf->lan_set_in_progress == SET_IN_PROGRESS)
                 {
-                    memcpy(data, &(channelConf->vlanID),
-                           ipmi::network::VLAN_SIZE_BYTE);
+                    std::memcpy(data, &(channelConf->vlanID),
+                                ipmi::network::VLAN_SIZE_BYTE);
                 }
             }
             break;
@@ -422,9 +423,9 @@
     {
         case LAN_PARM_IP:
         {
-            snprintf(ipaddr, INET_ADDRSTRLEN, ipmi::network::IP_ADDRESS_FORMAT,
-                     reqptr->data[0], reqptr->data[1], reqptr->data[2],
-                     reqptr->data[3]);
+            std::snprintf(ipaddr, INET_ADDRSTRLEN,
+                          ipmi::network::IP_ADDRESS_FORMAT, reqptr->data[0],
+                          reqptr->data[1], reqptr->data[2], reqptr->data[3]);
 
             channelConf->ipaddr.assign(ipaddr);
         }
@@ -433,7 +434,7 @@
         case LAN_PARM_IPSRC:
         {
             uint8_t ipsrc{};
-            memcpy(&ipsrc, reqptr->data, ipmi::network::IPSRC_SIZE_BYTE);
+            std::memcpy(&ipsrc, reqptr->data, ipmi::network::IPSRC_SIZE_BYTE);
             channelConf->ipsrc = static_cast<ipmi::network::IPOrigin>(ipsrc);
         }
         break;
@@ -442,9 +443,9 @@
         {
             char mac[SIZE_MAC];
 
-            snprintf(mac, SIZE_MAC, ipmi::network::MAC_ADDRESS_FORMAT,
-                     reqptr->data[0], reqptr->data[1], reqptr->data[2],
-                     reqptr->data[3], reqptr->data[4], reqptr->data[5]);
+            std::snprintf(mac, SIZE_MAC, ipmi::network::MAC_ADDRESS_FORMAT,
+                          reqptr->data[0], reqptr->data[1], reqptr->data[2],
+                          reqptr->data[3], reqptr->data[4], reqptr->data[5]);
 
             auto macObjectInfo =
                 ipmi::getDbusObject(bus, ipmi::network::MAC_INTERFACE,
@@ -460,18 +461,18 @@
 
         case LAN_PARM_SUBNET:
         {
-            snprintf(netmask, INET_ADDRSTRLEN, ipmi::network::IP_ADDRESS_FORMAT,
-                     reqptr->data[0], reqptr->data[1], reqptr->data[2],
-                     reqptr->data[3]);
+            std::snprintf(netmask, INET_ADDRSTRLEN,
+                          ipmi::network::IP_ADDRESS_FORMAT, reqptr->data[0],
+                          reqptr->data[1], reqptr->data[2], reqptr->data[3]);
             channelConf->netmask.assign(netmask);
         }
         break;
 
         case LAN_PARM_GATEWAY:
         {
-            snprintf(gateway, INET_ADDRSTRLEN, ipmi::network::IP_ADDRESS_FORMAT,
-                     reqptr->data[0], reqptr->data[1], reqptr->data[2],
-                     reqptr->data[3]);
+            std::snprintf(gateway, INET_ADDRSTRLEN,
+                          ipmi::network::IP_ADDRESS_FORMAT, reqptr->data[0],
+                          reqptr->data[1], reqptr->data[2], reqptr->data[3]);
             channelConf->gateway.assign(gateway);
         }
         break;
@@ -479,7 +480,7 @@
         case LAN_PARM_VLAN:
         {
             uint16_t vlan{};
-            memcpy(&vlan, reqptr->data, ipmi::network::VLAN_SIZE_BYTE);
+            std::memcpy(&vlan, reqptr->data, ipmi::network::VLAN_SIZE_BYTE);
             // We are not storing the enable bit
             // We assume that ipmitool always send enable
             // bit as 1.
@@ -553,7 +554,7 @@
     {
         // Only current revision was requested
         *data_len = sizeof(current_revision);
-        memcpy(response, &current_revision, *data_len);
+        std::memcpy(response, &current_revision, *data_len);
         return IPMI_CC_OK;
     }
 
@@ -584,19 +585,19 @@
     {
         uint8_t buf[] = {current_revision, channelConf->lan_set_in_progress};
         *data_len = sizeof(buf);
-        memcpy(response, &buf, *data_len);
+        std::memcpy(response, &buf, *data_len);
     }
     else if (reqptr->parameter == LAN_PARM_AUTHSUPPORT)
     {
         uint8_t buf[] = {current_revision, 0x04};
         *data_len = sizeof(buf);
-        memcpy(response, &buf, *data_len);
+        std::memcpy(response, &buf, *data_len);
     }
     else if (reqptr->parameter == LAN_PARM_AUTHENABLES)
     {
         uint8_t buf[] = {current_revision, 0x04, 0x04, 0x04, 0x04, 0x04};
         *data_len = sizeof(buf);
-        memcpy(response, &buf, *data_len);
+        std::memcpy(response, &buf, *data_len);
     }
     else if ((reqptr->parameter == LAN_PARM_IP) ||
              (reqptr->parameter == LAN_PARM_SUBNET) ||
@@ -606,7 +607,7 @@
         uint8_t buf[ipmi::network::MAC_ADDRESS_SIZE_BYTE + 1] = {};
 
         *data_len = sizeof(current_revision);
-        memcpy(buf, &current_revision, *data_len);
+        std::memcpy(buf, &current_revision, *data_len);
 
         if (getNetworkData(reqptr->parameter, &buf[1], channel) == IPMI_CC_OK)
         {
@@ -618,7 +619,7 @@
             {
                 *data_len = ipmi::network::IPV4_ADDRESS_SIZE_BYTE + 1;
             }
-            memcpy(response, &buf, *data_len);
+            std::memcpy(response, &buf, *data_len);
         }
         else
         {
@@ -630,22 +631,22 @@
         uint8_t buf[ipmi::network::VLAN_SIZE_BYTE + 1] = {};
 
         *data_len = sizeof(current_revision);
-        memcpy(buf, &current_revision, *data_len);
+        std::memcpy(buf, &current_revision, *data_len);
         if (getNetworkData(reqptr->parameter, &buf[1], channel) == IPMI_CC_OK)
         {
             *data_len = sizeof(buf);
-            memcpy(response, &buf, *data_len);
+            std::memcpy(response, &buf, *data_len);
         }
     }
     else if (reqptr->parameter == LAN_PARM_IPSRC)
     {
         uint8_t buff[ipmi::network::IPSRC_SIZE_BYTE + 1] = {};
         *data_len = sizeof(current_revision);
-        memcpy(buff, &current_revision, *data_len);
+        std::memcpy(buff, &current_revision, *data_len);
         if (getNetworkData(reqptr->parameter, &buff[1], channel) == IPMI_CC_OK)
         {
             *data_len = sizeof(buff);
-            memcpy(response, &buff, *data_len);
+            std::memcpy(response, &buff, *data_len);
         }
     }
     else if (reqptr->parameter == CIPHER_SUITE_COUNT)
