about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--lib/Core/ExecutionState.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Core/ExecutionState.cpp b/lib/Core/ExecutionState.cpp
index 3f92cccd..d6639208 100644
--- a/lib/Core/ExecutionState.cpp
+++ b/lib/Core/ExecutionState.cpp
@@ -419,7 +419,10 @@ std::string extractMetaEnvVar(ref<Expr> e) {
     return "";
   std::string value;
   constant->toString(value);
-  return "__SWITCH" + name.substr(8, name.size() - 8) + "=" + value;
+  unsigned char count = 1;
+  while (count < name.size() - 8 && name[count + 8] != '_')
+    ++count;
+  return "__SWITCH" + name.substr(8, count) + "=" + value;
 }
 
 void ExecutionState::addConstraint(ref<Expr> e) {