httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: NT: spaces in paths
Date Thu, 23 Oct 1997 18:10:32 GMT
Paul Sutton wrote:
> 
> Um, the MSVC runtime is *correctly* handling quote-delimited arguments on
> the command line (at least on NT). So
> 
>   apache -d "d:/program files/apache"
> 
> works fine, to start with. Then Apache spawns child processes. They have
> argv's like this passed to spawn():
> 
>   argv[0] = apache
>   argv[1] = -d
>   argv[2] = d:/program files/apache
>   argv[3] = NULL
> 
> So, no problem. But (and I can't believe this) when the child process
> starts, it gets:
> 
>   argv[0] = apache
>   argv[1] = -d
>   argv[2] = d:/program
>   argv[3] = files/apache
> 
> That is, WIN32 is *within the spawn()* function re-arranging the already
> specified arguments based on whether the arguments contain spaces.  Does
> it perhaps just printf all the argv[] options into a string. Umm, that's
> what the info browser implies ("the combined lengths of the arguments,
> plus the spaces inserted between the arguments, must not exceed 1024
> bytes"). NOOOOO! This is madness.

And they seriously think they can oust Unix with this kind of crap going
on? BTW, they almost certainly do have to do it this way because the
low-level functions that run things do just take one long string. Of
course, if they fix it, they'll have to say "the combined lengths of the
arguments, plus the spaces inserted between the arguments, plus two
times the number of arguments, must not exceed 1024 bytes", or, heaven
forfend, allocate a buffer of the right size.

I wonder if they check for overflows (NT security holes, here we come).

> 
> One work-around that seems to work is to quote all the arguments in
> spawn()'s argv, like this:
> 
>   argv[0] = "apache"
>   argv[1] = "-d"
>   argv[2] = "d:/program files/apache"
>   argv[3] = NULL
> 
> The patch (below) does this (this patch is not intended for use, just to
> illustate the point).

Wonder what we have to do to make a path with a " in it work. Can't use
a \, of course, coz that's just a path separator :-)

It wouldn't surprise me in the slightest if it just isn't possible.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |Apache-SSL author
A.L. Digital Ltd,     |http://www.algroup.co.uk/Apache-SSL
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache

Mime
View raw message