summaryrefslogtreecommitdiffstats
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
commite30d3c5cb4e0680501240db7f40ae67cf61d0249 (patch)
tree3a560ba2a05a166617b9623b564a3655f7eff434
parent688649d8a78555ed244e71089881fd17ba523fae (diff)
downloadruby-e30d3c5cb4e0680501240db7f40ae67cf61d0249.tar.gz
ruby-e30d3c5cb4e0680501240db7f40ae67cf61d0249.tar.xz
ruby-e30d3c5cb4e0680501240db7f40ae67cf61d0249.zip
* hash.c (env_has_value, env_index): must match exactly.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--hash.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 8bf6e9678..68dcf3711 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Nov 28 19:28:18 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (env_has_value, env_index): must match exactly.
+
Fri Nov 28 17:59:20 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* test/ruby/test_env.rb: add tests for ENV.
diff --git a/hash.c b/hash.c
index 5fe1dbc6a..102682c0b 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;