diff --git a/vtkext/private/module/vtkF3DEXRReader.cxx b/vtkext/private/module/vtkF3DEXRReader.cxx
index 4f3e22e2d7..2a8e482716 100644
--- a/vtkext/private/module/vtkF3DEXRReader.cxx
+++ b/vtkext/private/module/vtkF3DEXRReader.cxx
@@ -11,7 +11,7 @@
 #include <ImfIO.h>
 #include <ImfRgbaFile.h>
 
-#include <cstring>
+#include <algorithm>
 #include <sstream>
 #include <thread>
 
@@ -32,7 +32,7 @@ class MemStream : public Imf::IStream
   {
     if (pos + n <= bufflen)
     {
-      memcpy(c, buffer + pos, n);
+      std::copy_n(buffer + pos, n, c);
       pos += n;
       return true;
     }