VirtualBox

Changeset 94417 in vbox


Ignore:
Timestamp:
Mar 31, 2022 3:54:23 PM (2 years ago)
Author:
vboxsync
Message:

Validation Kit/unit tests: Sanitize handed-in paths. See comments for details. ​bugref:10195

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/tests/unittests/tdUnitTest1.py

    r94411 r94417  
    388388        self.fOnlyWhiteList = False;
    389389
     390    @staticmethod
     391    def _sanitizePath(sPath):
     392        """
     393        Does a little bit of sanitizing a given path by removing quoting, if any.
     394
     395        This is needed because handed-in paths via command line arguments can contain variables like "${CDROM}"
     396        which might need to get processed by TXS on the guest side first.
     397
     398        Returns the sanitized path.
     399        """
     400        if sPath is None: # Keep uninitialized strings as-is.
     401            return None;
     402        return sPath.strip('\"').strip('\'');
    390403
    391404    def _detectPaths(self):
     
    443456        else:
    444457            reporter.log2('VBox installation root already set to "%s"' % (self.sVBoxInstallRoot));
     458
     459        self.sVBoxInstallRoot = self._sanitizePath(self.sVBoxInstallRoot);
    445460
    446461        #
     
    475490        else:
    476491            reporter.log2('Unit test source dir already set to "%s"' % (self.sUnitTestsPathSrc));
     492
     493        self.sUnitTestsPathSrc = self._sanitizePath(self.sUnitTestsPathSrc);
    477494
    478495        return True;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette