summaryrefslogtreecommitdiff
path: root/src/option.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/option.cc')
-rw-r--r--src/option.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/option.cc b/src/option.cc
index 883080e2..8da66b36 100644
--- a/src/option.cc
+++ b/src/option.cc
@@ -116,13 +116,16 @@ void process_environment(const char ** envp, const string& tag,
const char * tag_p = tag.c_str();
string::size_type tag_len = tag.length();
+ assert(tag_p);
+ assert(tag_len > 0);
+
for (const char ** p = envp; *p; p++) {
- if (! tag_p || std::strncmp(*p, tag_p, tag_len) == 0) {
- char buf[128];
+ if (std::strlen(*p) >= tag_len && std::strncmp(*p, tag_p, tag_len) == 0) {
+ char buf[8192];
char * r = buf;
const char * q;
for (q = *p + tag_len;
- *q && *q != '=' && r - buf < 128;
+ *q && *q != '=' && r - buf < 8191;
q++)
if (*q == '_')
*r++ = '-';