Hello! I'm developing a little CGI application (in C, with CGIC, http://www.boutell.com/cgic/). My application needs to create a temporary file (the user upload an images, it is saved, modified in various ways, and then shown back to the user).
What precautions should I take while creating temporary files?
The modified image is provided dynamically by a CGI script which then removes the tempfile from disk:
Something like that:
<html><head><title>here's your modified image</title></head><body><img src="cgi-bin/genimage.cgi?uid=5423423 /></body>
However a malicious user could upload an image and never request the modified image, so filling the hard disk.
Should I remove periodically unused files?
Many thanks!