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 | e30d3c5cb4e0680501240db7f40ae67cf61d0249 (patch) | |
tree | 3a560ba2a05a166617b9623b564a3655f7eff434 | |
parent | 688649d8a78555ed244e71089881fd17ba523fae (diff) | |
download | ruby-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-- | ChangeLog | 4 | ||||
-rw-r--r-- | hash.c | 6 |
2 files changed, 8 insertions, 2 deletions
@@ -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. @@ -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; |