You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Marc Slemko <ma...@worldgate.com> on 1998/06/08 07:30:35 UTC
Re: cvs commit: apache-1.3/src/modules/standard mod_rewrite.c
On 3 Jun 1998 rse@hyperreal.org wrote:
> rse 98/06/03 05:12:12
>
> Modified: src CHANGES
> src/modules/standard mod_rewrite.c
> Log:
> Fix recently introduced Win32 child spawning code in mod_rewrite.c which was
> broken because of invalid ap_pstrcat() -> strcat() transformation. I'm a
> little bit confused: Seems like no one has actually compiled Apache with all
> modules under Win32 just before Jim rolled the 1.3.0 tarball. Because else
> someone had received a compile error. Hmmm... I knew why I hates to put code
> into mod_rewrite I couldn't test myself... :-(
Why is it using sprintf?
No. Code. Should. Use. sprintf. Almost.
We have an ap_snprintf. Use it. I don't care if it isn't necessary or
you think it isn't necessary or it may not be necessary or you hope it
isn't necessary. Always unless you shouldn't. And I see no reason why you
shouldn't here.
> +++ mod_rewrite.c 1998/06/03 12:12:11 1.114
> @@ -3190,11 +3190,11 @@
> #if defined(WIN32)
> /* MS Windows */
> {
> - char *pCommand;
> + char pCommand[MAX_STRING_LEN];
> STARTUPINFO si;
> PROCESS_INFORMATION pi;
>
> - pCommand = strcat(SHELL_PATH, " /C ", cmd, NULL);
> + sprintf(pCommand, "%s /C %s", SHELL_PATH, cmd);
>
> memset(&si, 0, sizeof(si));
> memset(&pi, 0, sizeof(pi));
>
>
>
>