"Juliusz Chroboczek" <j...@pps.jussieu.fr> wrote: >> +#ifdef WIN32 /* Require "x:/" */ >> + if(!isalpha(root->string[0]) || root->string[1] != ':') { >> + return -2; >> + } >> +#else > > Hmm... I know nothing about Windows, but shouldn't you be checking for > the third character being '/'?
Yes, that would be safer. Come to think of it, a syntax like "\\server\share\path\file" could be accepted. E.g. put the web-cache on another SMB/file-server :-) > What name do you want me to commit your patch under (please use > something suitable for a Git committer id, for exemple > "Gisle Vanem <gva...@broadpark.no>"). Okay. New improved diff: --- Git-latest\diskcache.c Thu Mar 31 17:13:34 2011 +++ diskcache.c Mon Apr 04 21:44:59 2011 @@ -123,14 +123,22 @@ checkRoot(AtomPtr root) { struct stat ss; - int rc; + int rc, okay; if(!root || root->length == 0) return 0; +#ifdef WIN32 /* Require "x:/" or "x:\\" */ + okay = isalpha(root->string[0]) && (root->string[1] == ':') && + ((root->string[2] == '/') || (root->string[2] == '\\')); + if(!okay) { + return -2; + } +#else if(root->string[0] != '/') { return -2; } +#endif rc = stat(root->string, &ss); if(rc < 0) -------------------- BTW. The above case handle DOS/Win slashes ('\\'), but many other places in Polipo almost require forward Unix-slashes ('/') it seems. All Win core APIs handles '\\' and '/' equally well. But maybe we should *deny* the use of '\\' to be consistent across Win/unix. --gv ------------------------------------------------------------------------------ Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev _______________________________________________ Polipo-users mailing list Polipo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/polipo-users