summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
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 5fe1dbc..102682c 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;