[rtems-tools commit] rtemstoolkit/path: Fix crash when going above the root directory.

Chris Johns chrisj at rtems.org
Tue Jun 19 03:43:29 UTC 2018


Module:    rtems-tools
Branch:    master
Commit:    f7d303f104626e512bfe84ba0695b309dd542d19
Changeset: http://git.rtems.org/rtems-tools/commit/?id=f7d303f104626e512bfe84ba0695b309dd542d19

Author:    Chris Johns <chrisj at rtems.org>
Date:      Tue May  8 15:09:45 2018 +1000

rtemstoolkit/path: Fix crash when going above the root directory.

---

 rtemstoolkit/rld-path.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/rtemstoolkit/rld-path.cpp b/rtemstoolkit/rld-path.cpp
index c848676..35af055 100644
--- a/rtemstoolkit/rld-path.cpp
+++ b/rtemstoolkit/rld-path.cpp
@@ -145,7 +145,13 @@ namespace rld
         }
         else if (dir == "..")
         {
+          /*
+           * If the path goes above the root of where we are there is nothing
+           * that can be done so return the path passed in.
+           */
           aps.pop_back ();
+          if (aps.empty ())
+            return path;
         }
         else
         {




More information about the vc mailing list