openbsd-ports/www/clearsilver/patches/patch-cgi_cgi_c
okan e28524993a - update to 0.10.5
- more str* and 64bit fixes
- update license marker

ok markus (MAINTAINER)
2008-11-11 19:58:15 +00:00

35 lines
1.3 KiB
Plaintext

--- cgi/cgi.c.orig Wed Jul 11 22:38:03 2007
+++ cgi/cgi.c Thu Jun 26 13:42:32 2008
@@ -508,7 +508,7 @@ static void _launch_debugger (CGI *cgi, char *display)
if (!pid)
{
- sprintf(buffer, debugger, display, Argv0, myPid);
+ snprintf(buffer, sizeof(buffer), debugger, display, Argv0, myPid);
execl("/bin/sh", "sh", "-c", buffer, NULL);
}
else
@@ -1210,11 +1210,11 @@ NEOERR *cgi_output (CGI *cgi, STRING *str)
{
if (use_gzip)
{
- /* I'm using sprintf instead of cgiwrap_writef since
+ /* I'm using snprintf instead of cgiwrap_writef since
* the wrapper writef might not handle values with
* embedded NULLs... though I should fix the python one
* now as well */
- sprintf(gz_buf, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
+ snprintf(gz_buf, sizeof(gz_buf), "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/,
OS_CODE);
err = cgiwrap_write(gz_buf, 10);
@@ -1226,7 +1226,7 @@ NEOERR *cgi_output (CGI *cgi, STRING *str)
if (use_gzip)
{
/* write crc and len in network order */
- sprintf(gz_buf, "%c%c%c%c%c%c%c%c",
+ snprintf(gz_buf, sizeof(gz_buf), "%c%c%c%c%c%c%c%c",
(0xff & (crc >> 0)),
(0xff & (crc >> 8)),
(0xff & (crc >> 16)),