about summary refs log tree commit diff
path: root/src/rt/rust_log.cpp
diff options
context:
space:
mode:
authorBrian Anderson <andersrb@gmail.com>2011-05-13 23:20:01 -0400
committerBrian Anderson <andersrb@gmail.com>2011-05-13 23:22:29 -0400
commit0b73b29383ffc357fa02452fda9dd2895f439960 (patch)
tree8ffe891164771e23a567d9df88756ed2de3f5571 /src/rt/rust_log.cpp
parent9e9d57657db3eb049cc74c35a6f6323f48551fe0 (diff)
downloadrust-0b73b29383ffc357fa02452fda9dd2895f439960.tar.gz
rust-0b73b29383ffc357fa02452fda9dd2895f439960.zip
rt: Don't overshoot the end of the logging spec during parsing
Diffstat (limited to 'src/rt/rust_log.cpp')
-rw-r--r--src/rt/rust_log.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/rt/rust_log.cpp b/src/rt/rust_log.cpp
index 6152e112d00..afb7096b322 100644
--- a/src/rt/rust_log.cpp
+++ b/src/rt/rust_log.cpp
@@ -154,10 +154,12 @@ size_t parse_logging_spec(char* spec, log_directive* dirs) {
             cur = *spec;
             if (cur == ',' || cur == '=' || cur == '\0') {
                 if (start == spec) {spec++; break;}
-                *spec = '\0';
-                spec++;
+                if (*spec != '\0') {
+                    *spec = '\0';
+                    spec++;
+                }
                 size_t level = max_log_level;
-                if (cur == '=') {
+                if (cur == '=' && *spec != '\0') {
                     level = *spec - '0';
                     if (level > max_log_level) level = max_log_level;
                     if (*spec) ++spec;
@@ -165,8 +167,9 @@ size_t parse_logging_spec(char* spec, log_directive* dirs) {
                 dirs[dir].name = start;
                 dirs[dir++].level = level;
                 break;
+            } else {
+                spec++;
             }
-            spec++;
         }
     }
     return dir;