diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-28 10:28:21 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-28 10:28:21 +0000 |
commit | f284f6a41ba4de19a18dff6bde7ad8b2cba0f3ba (patch) | |
tree | 3a560ba2a05a166617b9623b564a3655f7eff434 /hash.c | |
parent | 275d6a57758b3b33628e3584c959b66c34110188 (diff) |
* hash.c (env_has_value, env_index): must match exactly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1598,7 +1598,8 @@ env_has_value(dmy, value) while (*env) { char *s = strchr(*env, '='); if (s++) { - if (strncmp(s, RSTRING(value)->ptr, strlen(s)) == 0) { + long len = strlen(s); + if (RSTRING(value)->len == len && strncmp(s, RSTRING(value)->ptr, len) == 0) { FREE_ENVIRON(environ); return Qtrue; } @@ -1621,7 +1622,8 @@ env_index(dmy, value) while (*env) { char *s = strchr(*env, '='); if (s++) { - if (strncmp(s, RSTRING(value)->ptr, strlen(s)) == 0) { + long len = strlen(s); + if (RSTRING(value)->len == len && strncmp(s, RSTRING(value)->ptr, len) == 0) { str = env_str_new(*env, s-*env-1); FREE_ENVIRON(environ); return str; |