From e30d3c5cb4e0680501240db7f40ae67cf61d0249 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 28 Nov 2003 10:28:21 +0000 Subject: * 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 --- hash.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'hash.c') 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; -- cgit