mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
Vodz, last_patch_110
no limit, no memory usage for env buffer, always call putenv(). remove small error for previous last_patch109.
This commit is contained in:
parent
55bf79f944
commit
5875be406e
@ -202,13 +202,6 @@ void bb_show_usage(void)
|
|||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* CGI environ size */
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_SET_CGI_VARS_TO_ENV
|
|
||||||
#define ENVSIZE 70 /* set max CGI variable */
|
|
||||||
#else
|
|
||||||
#define ENVSIZE 15 /* minimal requires */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MAX_POST_SIZE (64*1024) /* 64k. Its Small? May be ;) */
|
#define MAX_POST_SIZE (64*1024) /* 64k. Its Small? May be ;) */
|
||||||
|
|
||||||
#define MAX_MEMORY_BUFF 8192 /* IO buffer */
|
#define MAX_MEMORY_BUFF 8192 /* IO buffer */
|
||||||
@ -228,10 +221,6 @@ typedef struct HT_ACCESS_IP {
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CGI
|
|
||||||
char *envp[ENVSIZE+1];
|
|
||||||
int envCount;
|
|
||||||
#endif
|
|
||||||
char buf[MAX_MEMORY_BUFF];
|
char buf[MAX_MEMORY_BUFF];
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
||||||
@ -659,20 +648,17 @@ static void parse_conf(const char *path, int flag)
|
|||||||
c = strchr(cf, ':');
|
c = strchr(cf, ':');
|
||||||
*c++ = 0;
|
*c++ = 0;
|
||||||
cur->after_colon = c;
|
cur->after_colon = c;
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
|
||||||
if(*cf == '/')
|
|
||||||
free(p0);
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
#ifdef CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES
|
||||||
else if(*cf == '.') {
|
if(*cf == '.') {
|
||||||
/* config .mime line move top for overwrite previous */
|
/* config .mime line move top for overwrite previous */
|
||||||
cur->next = config->mime_a;
|
cur->next = config->mime_a;
|
||||||
config->mime_a = cur;
|
config->mime_a = cur;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
|
||||||
else if(prev == NULL) {
|
free(p0);
|
||||||
|
if(prev == NULL) {
|
||||||
/* first line */
|
/* first line */
|
||||||
config->auth = prev = cur;
|
config->auth = prev = cur;
|
||||||
} else {
|
} else {
|
||||||
@ -809,19 +795,16 @@ static char *decodeString(char *orig, int flag_plus_to_space)
|
|||||||
static void addEnv(const char *name_before_underline,
|
static void addEnv(const char *name_before_underline,
|
||||||
const char *name_after_underline, const char *value)
|
const char *name_after_underline, const char *value)
|
||||||
{
|
{
|
||||||
char *s;
|
char *s = NULL;
|
||||||
const char *underline;
|
const char *underline;
|
||||||
|
|
||||||
if (config->envCount >= ENVSIZE)
|
|
||||||
return;
|
|
||||||
if (!value)
|
if (!value)
|
||||||
value = "";
|
value = "";
|
||||||
underline = *name_after_underline ? "_" : "";
|
underline = *name_after_underline ? "_" : "";
|
||||||
asprintf(&s, "%s%s%s=%s", name_before_underline, underline,
|
asprintf(&s, "%s%s%s=%s", name_before_underline, underline,
|
||||||
name_after_underline, value);
|
name_after_underline, value);
|
||||||
if(s) {
|
if(s) {
|
||||||
config->envp[config->envCount++] = s;
|
putenv(s);
|
||||||
config->envp[config->envCount] = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1242,7 +1225,7 @@ static int sendCgi(const char *url,
|
|||||||
// now run the program. If it fails,
|
// now run the program. If it fails,
|
||||||
// use _exit() so no destructors
|
// use _exit() so no destructors
|
||||||
// get called and make a mess.
|
// get called and make a mess.
|
||||||
execve(realpath_buff, argp, config->envp);
|
execv(realpath_buff, argp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user