Coverity-CWE 22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Coverity fix for 137960 Filesystem path, filename, or URI manipulation
Change-Id: Ieaa291ced268216361d865427100fd48bd39ed5a
Signed-off-by: k4.rahul <rahul.k4@tataelxsi.co.in>
diff --git a/osm_lcm/lcm.py b/osm_lcm/lcm.py
index 9b62d82..f8a97ae 100644
--- a/osm_lcm/lcm.py
+++ b/osm_lcm/lcm.py
@@ -21,6 +21,7 @@
# DEBUG WITH PDB
import pdb
+import os
import asyncio
import yaml
import logging
@@ -880,6 +881,7 @@
file=sys.stderr,
)
exit(1)
+ config_file = os.path.realpath(os.path.normpath(os.path.abspath(config_file)))
lcm = Lcm(config_file)
asyncio.run(lcm.start())
except (LcmException, getopt.GetoptError) as e: