]> git.saurik.com Git - wxWidgets.git/commitdiff
guard against empty name field in inotify_event, see #14466
authorPaul Cornett <paulcor@bullseye.com>
Fri, 6 Jul 2012 16:39:08 +0000 (16:39 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Fri, 6 Jul 2012 16:39:08 +0000 (16:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71967 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/unix/fswatcher_inotify.cpp

index 6c27e5c0f2336975528a905e5fc6f9e32ebad1ae..1ad02086e34d88bc3442e68c4bfbb59ac31989da 100644 (file)
@@ -344,9 +344,12 @@ protected:
         wxString mask = (inevt.mask & IN_ISDIR) ?
                         wxString::Format("IS_DIR | %u", inevt.mask & ~IN_ISDIR) :
                         wxString::Format("%u", inevt.mask);
+        const char* name = "";
+        if (inevt.len)
+            name = inevt.name;
         return wxString::Format("Event: wd=%d, mask=%s, cookie=%u, len=%u, "
                                 "name=%s", inevt.wd, mask, inevt.cookie,
-                                inevt.len, inevt.name);
+                                inevt.len, name);
     }
 
     static wxFileName GetEventPath(const wxFSWatchEntry& watch,
@@ -354,7 +357,7 @@ protected:
     {
         // only when dir is watched, we have non-empty e.name
         wxFileName path = watch.GetPath();
-        if (path.IsDir())
+        if (path.IsDir() && inevt.len)
         {
             path = wxFileName(path.GetPath(), inevt.name);
         }