]> git.lyx.org Git - features.git/blobdiff - src/VSpace.cpp
Fix unsafe use of fixed width arrays.
[features.git] / src / VSpace.cpp
index 19f6af41a1f638d282263e6f6be1ef01ccdf19a3..06799263f4e01a2049ff40d51e3941a6d446d978 100644 (file)
@@ -246,14 +246,14 @@ bool isValidGlueLength(string const & data, GlueLength * result)
 
        int  pattern_index = 0;
        int  table_index = 0;
-       char pattern[20];
+       char pattern[22]; // 20 + 1 for pattern[20], + 1 for '\0'
 
        number_index = 1;
        unit_index = 1;  // entries at index 0 are sentinels
 
        // construct "pattern" from "data"
        while (!isEndOfData(buffer)) {
-               if (pattern_index > 20)
+               if (pattern_index > (sizeof(pattern) - 2))
                        return false;
                pattern[pattern_index] = nextToken(buffer);
                if (pattern[pattern_index] == 'E')