Stop using strcpy() in WebProcess::registerWithStateDumper() in WebProcessCocoa.mm
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 May 2017 21:24:58 +0000 (21:24 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 May 2017 21:24:58 +0000 (21:24 +0000)
<https://webkit.org/b/171520>

Reviewed by Chris Dumez.

* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::registerWithStateDumper): Switch from
strcpy() to strlcpy(), removing comment in the process.

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

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm

index 64eff13..c51150a 100644 (file)
@@ -1,3 +1,14 @@
+2017-05-02  David Kilzer  <ddkilzer@apple.com>
+
+        Stop using strcpy() in WebProcess::registerWithStateDumper() in WebProcessCocoa.mm
+        <https://webkit.org/b/171520>
+
+        Reviewed by Chris Dumez.
+
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::registerWithStateDumper): Switch from
+        strcpy() to strlcpy(), removing comment in the process.
+
 2017-05-02  Andrew Gold  <agold@apple.com>
 
         MediaDevices is not enabled for MobileSafari
index 0b0beb6..4df8ec4 100644 (file)
@@ -283,7 +283,7 @@ void WebProcess::registerWithStateDumper()
                 memset(os_state, 0, neededSize);
                 os_state->osd_type = OS_STATE_DATA_SERIALIZED_NSCF_OBJECT;
                 os_state->osd_data_size = data.length;
-                strcpy(os_state->osd_title, "WebContent state"); // NB: Only 64 bytes of buffer here.
+                strlcpy(os_state->osd_title, "WebContent state", sizeof(os_state->osd_title));
                 memcpy(os_state->osd_data, data.bytes, data.length);
             }