diff options
author | Christophe Grenier <grenier@cgsecurity.org> | 2024-05-18 16:17:23 +0200 |
---|---|---|
committer | Christophe Grenier <grenier@cgsecurity.org> | 2024-05-18 16:17:23 +0200 |
commit | d936a2d4c4d78e1aadd3a67cde2845090777485d (patch) | |
tree | b76c3cdeafbf2518e98efcc8b21d440e0d67d030 /src/common.c | |
parent | ae3b0a835f76e0bdd6a6f1a9f3cc28eca327c87b (diff) |
strip_dup() terminates
Diffstat (limited to 'src/common.c')
-rw-r--r-- | src/common.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/common.c b/src/common.c index 3856df6e..c722bff2 100644 --- a/src/common.c +++ b/src/common.c @@ -61,7 +61,10 @@ static long secwest=0; void *MALLOC(size_t size) { void *res; + /*@ assert size > 0; */ +#ifdef DISABLED_FOR_FRAMAC assert(size>0); +#endif /* Warning, memory leak checker must be posix_memalign/memalign aware, otherwise * * reports may look strange. Aligned memory is required if the buffer is * * used for read/write operation with a file opened with O_DIRECT */ @@ -235,6 +238,7 @@ char* strip_dup(char* str) /*@ @ loop invariant valid_string(str); @ loop assigns str; + @ loop variant strlen(\at(str, Pre)) - strlen(str); @*/ while(isspace(*str)) str++; @@ -244,7 +248,8 @@ char* strip_dup(char* str) @ loop invariant valid_string(tmp); @ loop invariant valid_string(end); @ loop invariant end == str || *end != '\0'; - @ loop assigns end; + @ loop assigns tmp, end; + @ loop variant strlen(str) - strlen(tmp); @*/ for(tmp = str; *tmp != 0; tmp++) if(!isspace(*tmp)) |