[2/3] checksum: sanity check path when recursively checksumming

Message ID 20180813172054.17767-2-ross.burton@intel.com
State New
Headers show
Series
  • [1/3] utils/md5_file: don't iterate line-by-line
Related show

Commit Message

Burton, Ross Aug. 13, 2018, 5:20 p.m.
In case something goes tragically wrong, catch a request to checksum / and
refuse.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 bitbake/lib/bb/checksum.py | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

diff --git a/bitbake/lib/bb/checksum.py b/bitbake/lib/bb/checksum.py
index 84289208f44..4e1598fe835 100644
--- a/bitbake/lib/bb/checksum.py
+++ b/bitbake/lib/bb/checksum.py
@@ -97,6 +97,8 @@  class FileChecksumCache(MultiProcessCache):
 
         def checksum_dir(pth):
             # Handle directories recursively
+            if pth == "/":
+                bb.fatal("Refusing to checksum /")
             dirchecksums = []
             for root, dirs, files in os.walk(pth):
                 for name in files: