[vte] spawn: Tighten envv precondition check



commit 52aa14a13fd9fbfdf7c8b50970bc9315c346707d
Author: Christian Persch <chpe src gnome org>
Date:   Fri May 1 10:21:16 2020 +0200

    spawn: Tighten envv precondition check

 src/vtepty.cc | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/vtepty.cc b/src/vtepty.cc
index 7d52ab95..94708b95 100644
--- a/src/vtepty.cc
+++ b/src/vtepty.cc
@@ -652,12 +652,12 @@ _vte_pty_check_envv(char const* const* strv)
   if (!strv)
     return true;
 
-  char const *p;
-  while ((p = *strv++))
-    {
-      if (!strchr(p, '='))
-        return false;
-    }
+  for (int i = 0; strv[i]; ++i) {
+          const char *str = strv[i];
+          const char *equal = strchr(str, '=');
+          if (equal == NULL || equal == str)
+                  return false;
+  }
 
   return true;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]