aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoni Sawicki <tenox@google.com>2019-05-10 01:14:21 -0700
committerAntoni Sawicki <tenox@google.com>2019-05-10 01:14:21 -0700
commitc5a26208302f65c9cb54d4541fe1004799d72f80 (patch)
treeb0edf48b6de20206b6bda5578ac8303363fa79b1
parentccd3aa06f871d1564ed3e95c339ab2768e9eed74 (diff)
downloadwfm-c5a26208302f65c9cb54d4541fe1004799d72f80.tar.gz
added latest cgic
-rw-r--r--cgic.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/cgic.c b/cgic.c
index 4cb7521..4eef9ed 100644
--- a/cgic.c
+++ b/cgic.c
@@ -4,9 +4,10 @@
/* Used only in Unix environments, in conjunction with mkstemp().
Elsewhere (Windows), temporary files go where the tmpnam()
function suggests. If this behavior does not work for you,
- modify the getTempFileName() function to suit your needs. */
+ modify the getTempFile() function to suit your needs. */
#define cgicTempDir "/tmp"
+#define cgicMaxTempSize 1073741824
#if CGICDEBUG
#define CGICDEBUGSTART \
@@ -436,7 +437,7 @@ static void decomposeValue(char *value,
char **argValues,
int argValueSpace);
-static cgiParseResultType getTempFileName(FILE **tFile);
+static cgiParseResultType getTempFile(FILE **tFile);
static cgiParseResultType cgiParsePostMultipartInput() {
cgiParseResultType result;
@@ -528,7 +529,7 @@ static cgiParseResultType cgiParsePostMultipartInput() {
Otherwise, store to a memory buffer (it is
presumably a regular form field). */
if (strlen(ffileName)) {
- if (getTempFileName(&outf) != cgiParseSuccess) {
+ if (getTempFile(&outf) != cgiParseSuccess) {
return cgiParseIO;
}
} else {
@@ -624,7 +625,7 @@ outOfMemory:
return cgiParseMemory;
}
-static cgiParseResultType getTempFileName(FILE **tFile)
+static cgiParseResultType getTempFile(FILE **tFile)
{
/* tfileName must be 1024 bytes to ensure adequacy on
win32 (1024 exceeds the maximum path length and
@@ -758,12 +759,10 @@ cgiParseResultType afterNextBoundary(mpStreamPtr mpp, FILE *outf, char **outP,
/* Not presently in the middle of a boundary
match; just emit the character. */
BAPPEND(d[0]);
- }
-#ifdef CGIMAXTEMPFILESIZE
- if(outLen >= CGIMAXTEMPFILESIZE) {
+ }
+ if(outLen > cgicMaxTempSize) {
goto outOfMemory;
}
-#endif
}
/* Read trailing newline or -- EOF marker. A literal EOF here
would be an error in the input stream. */
@@ -2165,7 +2164,7 @@ cgiEnvironmentResultType cgiReadEnvironment(char *filename) {
FILE *out = NULL;
int got;
int len = e->valueLength;
- if (getTempFileName(&out)
+ if (getTempFile(&out)
!= cgiParseSuccess || !out)
{
result = cgiEnvironmentIO;