diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | b.c | 2 | ||||
-rw-r--r-- | lex.c | 2 | ||||
-rw-r--r-- | tran.c | 6 |
4 files changed, 13 insertions, 4 deletions
@@ -1,3 +1,10 @@ +2020-01-06 Arnold D. Robbins <arnold@skeeve.com> + + Minor fixes. + * b.c (replace_repeat): Turn init_q back into an int. + * lex.c (string): Use \a instead of \007. + * tran.c (catstr): Use snprintf instead of sprintf. + 2020-01-01 Arnold D. Robbins <arnold@skeeve.com> * tran.c (syminit, arginit, envinit): Free sval member before @@ -909,7 +909,7 @@ replace_repeat(const uschar *reptok, int reptoklen, const uschar *atom, int i, j; uschar *buf = 0; int ret = 1; - bool init_q = (firstnum == 0); /* first added char will be ? */ + int init_q = (firstnum == 0); /* first added char will be ? */ int n_q_reps = secondnum-firstnum; /* m>n, so reduce until {1,m-n} left */ int prefix_length = reptok - basestr; /* prefix includes first rep */ int suffix_length = strlen((const char *) reptok) - reptoklen; /* string after rep specifier */ @@ -390,7 +390,7 @@ int string(void) case 'r': *bp++ = '\r'; break; case 'b': *bp++ = '\b'; break; case 'v': *bp++ = '\v'; break; - case 'a': *bp++ = '\007'; break; + case 'a': *bp++ = '\a'; break; case '\\': *bp++ = '\\'; break; case '0': case '1': case '2': /* octal: \d \dd \ddd */ @@ -527,12 +527,14 @@ Cell *catstr(Cell *a, Cell *b) /* concatenate a and b */ if (p == NULL) FATAL("out of space concatenating %s and %s", sa, sb); snprintf(p, l, "%s%s", sa, sb); - char *newbuf = malloc(strlen(p) + 2); + + l++; // add room for ' ' + char *newbuf = malloc(l); if (newbuf == NULL) FATAL("out of space concatenating %s and %s", sa, sb); // See string() in lex.c; a string "xx" is stored in the symbol // table as "xx ". - sprintf(newbuf, "%s ", p); + snprintf(newbuf, l, "%s ", p); c = setsymtab(newbuf, p, 0.0, CON|STR|DONTFREE, symtab); free(p); free(newbuf); |