Remove use of strcpy from JSC
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Apr 2017 23:47:14 +0000 (23:47 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Apr 2017 23:47:14 +0000 (23:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170646

Reviewed by Mark Lam.

Replace the use of strcpy with memcpy as strcpy keeps
on tripping various analyser warnings even though its
trivially safe in this case.

Essentially code hygiene, no change in behaviour, no
perf impact.

* dfg/DFGDisassembler.cpp:
(JSC::DFG::Disassembler::dumpDisassembly):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215168 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGDisassembler.cpp

index 908d538..c5c88d0 100644 (file)
@@ -1,3 +1,20 @@
+2017-04-08  Oliver Hunt  <oliver@apple.com>
+
+        Remove use of strcpy from JSC
+        https://bugs.webkit.org/show_bug.cgi?id=170646
+
+        Reviewed by Mark Lam.
+
+        Replace the use of strcpy with memcpy as strcpy keeps
+        on tripping various analyser warnings even though its
+        trivially safe in this case.
+
+        Essentially code hygiene, no change in behaviour, no
+        perf impact.
+
+        * dfg/DFGDisassembler.cpp:
+        (JSC::DFG::Disassembler::dumpDisassembly):
+
 2017-04-09  Joseph Pecoraro  <pecoraro@apple.com>
 
         test262: test262/test/annexB/language/expressions/object/__proto__-fn-name.js
index 15cbea0..168a16d 100644 (file)
@@ -159,7 +159,7 @@ void Disassembler::dumpDisassembly(PrintStream& out, const char* prefix, LinkBuf
     else
         amountOfNodeWhiteSpace = Graph::amountOfNodeWhiteSpace(context);
     auto prefixBuffer = std::make_unique<char[]>(prefixLength + amountOfNodeWhiteSpace + 1);
-    strcpy(prefixBuffer.get(), prefix);
+    memcpy(prefixBuffer.get(), prefix, prefixLength);
     for (int i = 0; i < amountOfNodeWhiteSpace; ++i)
         prefixBuffer[i + prefixLength] = ' ';
     prefixBuffer[prefixLength + amountOfNodeWhiteSpace] = 0;