summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-28 10:28:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-28 10:28:21 +0000
commitf284f6a41ba4de19a18dff6bde7ad8b2cba0f3ba (patch)
tree3a560ba2a05a166617b9623b564a3655f7eff434 /hash.c
parent275d6a57758b3b33628e3584c959b66c34110188 (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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index 5fe1dbc6ae..102682c0b3 100644
--- a/hash.c
+++ b/hash.c
@@ -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;