Security fix:
authorTon Roosendaal <ton@blender.org>
Sat, 12 Jan 2013 11:59:22 +0000 (11:59 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 12 Jan 2013 11:59:22 +0000 (11:59 +0000)
"Pack Blender Libraries" now first does a check if the .blend files are all used
with relative paths. This to prevent bad things happen on unpacking.

source/blender/blenkernel/intern/packedFile.c

index 9f77094..9fab052 100644 (file)
@@ -553,7 +553,7 @@ int unpackLibraries(Main *bmain, ReportList *reports)
                        if (newname != NULL) {
                                ret_value = RET_OK;
                                
-                               printf("Saved .blend library: %s\n", newname);
+                               printf("Unpacked .blend library: %s\n", newname);
                                
                                freePackedFile(lib->packedfile);
                                lib->packedfile = NULL;
@@ -570,6 +570,16 @@ void packLibraries(Main *bmain, ReportList *reports)
 {
        Library *lib;
        
+       /* test for relativenss */
+       for (lib = bmain->library.first; lib; lib = lib->id.next)
+               if (0 == BLI_path_is_rel(lib->name))
+                       break;
+       
+       if (lib) {
+               BKE_reportf(reports, RPT_ERROR, "Cannot pack absolute file: '%s'", lib->name);
+               return;
+       }
+       
        for (lib = bmain->library.first; lib; lib = lib->id.next)
                if (lib->packedfile == NULL)
                        lib->packedfile = newPackedFile(reports, lib->name, bmain->name);