[haiku-commits] r40625 - haiku/trunk/src/kits/storage

  • From: jonas@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 23 Feb 2011 01:01:16 +0100 (CET)

Author: kirilla
Date: 2011-02-23 01:01:16 +0100 (Wed, 23 Feb 2011)
New Revision: 40625
Changeset: http://dev.haiku-os.org/changeset/40625

Modified:
   haiku/trunk/src/kits/storage/AddOnMonitorHandler.cpp
Log:
Unsafe use of strncpy replaced by strlcpy. CID 2264, 2265.

Modified: haiku/trunk/src/kits/storage/AddOnMonitorHandler.cpp
===================================================================
--- haiku/trunk/src/kits/storage/AddOnMonitorHandler.cpp        2011-02-22 
22:57:20 UTC (rev 40624)
+++ haiku/trunk/src/kits/storage/AddOnMonitorHandler.cpp        2011-02-23 
00:01:16 UTC (rev 40625)
@@ -141,7 +141,7 @@
        dev_t device, ino_t node)
 {
        add_on_entry_info entryInfo;
-       strncpy(entryInfo.name, name, sizeof(entryInfo.name));
+       strlcpy(entryInfo.name, name, sizeof(entryInfo.name));
        make_node_ref(device, node, &entryInfo.nref);
        make_node_ref(device, directory, &entryInfo.dir_nref);
        fPendingEntries.push_back(entryInfo);
@@ -286,7 +286,7 @@
                // moved into our view
 
                // update the info
-               strncpy(info.name, name, sizeof(info.name));
+               strlcpy(info.name, name, sizeof(info.name));
                info.nref = entryNodeRef;
                info.dir_nref = toNodeRef;
 
@@ -378,7 +378,7 @@
                AddOnRemoved(&info);
 
                // set up new addon info
-               strncpy(info.name, name, sizeof(info.name));
+               strlcpy(info.name, name, sizeof(info.name));
                info.dir_nref = toNodeRef;
 
                // presto!


Other related posts:

  • » [haiku-commits] r40625 - haiku/trunk/src/kits/storage - jonas