diff options
author | Matthias Huetsch [mhu] <matthias.huetsch@oracle.com> | 2010-11-25 14:14:24 +0100 |
---|---|---|
committer | Matthias Huetsch [mhu] <matthias.huetsch@oracle.com> | 2010-11-25 14:14:24 +0100 |
commit | dc09799bb92c397fbf48f0efe863cd358dc6a1f8 (patch) | |
tree | 62630f50eb0c4029b72efb1836b3546d2b000c39 /soltools | |
parent | b24c11f89613f6d9ed3429e642b0c4bd610efd7e (diff) |
#i115784# soltools: fix memory errors uncovered by valgrind and other tools.
Diffstat (limited to 'soltools')
-rw-r--r-- | soltools/cpp/_eval.c | 13 | ||||
-rw-r--r-- | soltools/cpp/_lex.c | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/soltools/cpp/_eval.c b/soltools/cpp/_eval.c index a652e488d78f..a6406faed788 100644 --- a/soltools/cpp/_eval.c +++ b/soltools/cpp/_eval.c @@ -1,6 +1,7 @@ +#include "cpp.h" + #include <stdlib.h> #include <string.h> -#include "cpp.h" #define NSTAK 32 #define SGN 0 @@ -711,11 +712,11 @@ struct value } else { - static char cvcon[] - = "b\bf\fn\nr\rt\tv\v''\"\"??\\\\"; - size_t j; + static char cvcon[] = "b\bf\fn\nr\rt\tv\v''\"\"??\\\\"; + static size_t cvlen = sizeof(cvcon) - 1; - for (j = 0; j < sizeof(cvcon); j += 2) + size_t j; + for (j = 0; j < cvlen; j += 2) { if (*p == cvcon[j]) { @@ -724,7 +725,7 @@ struct value } } p += 1; - if (j >= sizeof(cvcon)) + if (j >= cvlen) error(WARNING, "Undefined escape in character constant"); } diff --git a/soltools/cpp/_lex.c b/soltools/cpp/_lex.c index 2ff188ff2264..2236fd9db260 100644 --- a/soltools/cpp/_lex.c +++ b/soltools/cpp/_lex.c @@ -262,7 +262,7 @@ void bigfsm[j][fp->state] = (short) nstate; continue; case C_ALPH: - for (j = 0; j <= 256; j++) + for (j = 0; j < 256; j++) #ifdef S390 if( isalpha( j ) || (j == '_') ) #else |