Coverity-CWE 22: Improper Limitation of a Pathname to a Restricted Directory ('Path... 39/13339/3
authork4.rahul <rahul.k4@tataelxsi.co.in>
Fri, 5 May 2023 08:54:31 +0000 (14:24 +0530)
committerrahulkumarr <rahul.k4@tataelxsi.co.in>
Wed, 29 May 2024 06:36:57 +0000 (12:06 +0530)
Coverity fix for 137960 Filesystem path, filename, or URI manipulation

Change-Id: Ieaa291ced268216361d865427100fd48bd39ed5a
Signed-off-by: k4.rahul <rahul.k4@tataelxsi.co.in>
osm_lcm/lcm.py

index 9b62d82..f8a97ae 100644 (file)
@@ -21,6 +21,7 @@
 # DEBUG WITH PDB
 import pdb
 
 # DEBUG WITH PDB
 import pdb
 
+import os
 import asyncio
 import yaml
 import logging
 import asyncio
 import yaml
 import logging
@@ -880,6 +881,7 @@ if __name__ == "__main__":
                     file=sys.stderr,
                 )
                 exit(1)
                     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:
         lcm = Lcm(config_file)
         asyncio.run(lcm.start())
     except (LcmException, getopt.GetoptError) as e: