[Bf-committers] Critical error in Blender!

Chris Burt desoto at blender.spaceisbig.com
Thu Dec 16 19:24:00 CET 2004


Possible to add windows support for recursive delete at this point?

Yann Vernier wrote:
> On Thu, Dec 16, 2004 at 03:39:48PM +0100, Ton Roosendaal wrote:
> 
>>The solution obviously is securing the filenames passed on to system()  
>>with quotes. My upcoming commit will do that. for example like:
>>
>>sprintf(str, "/bin/rm -rf \"%s\"", file);
> 
> Okay, so with typical shell expansion.. you're wide open to someone
> doing $(rm -rf /), but that's less likely to be a mistake. You can't
> guard against all these as it's unknown what the shell chooses to do.
> 
> 
>>I would like interested/experienced C developers to check on this too.  
>>There seem to be much better methods for (recursive) operations on  
>>files. Probably worth a recode. And/or maybe even stick to OS specific  
>>calls, which (I guess) for OSX could mean a delete would move things to  
>>the ~/.trash folder?
> 
> 
> Definitely worth a recode. system() is one of the most dangerous library
> functions around, in particular since you then rely on whatever the
> shell chooses to do with the string, and the shell varies wildly. I'm
> attaching a patch that shows how these could be implemented in a safer
> and more efficient manner, but this isn't complete yet - in particular
> the call to mv should be wrapped and use execv or execl, not system.
> 
> I haven't actually compiled this variant yet, though I've written
> similar code in the past. Comments are welcome.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers


More information about the Bf-committers mailing list