diff --git a/ChangeLog b/ChangeLog index 77271dc..1afd9de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-01-06 Arnold D. Robbins + + 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 * tran.c (syminit, arginit, envinit): Free sval member before diff --git a/b.c b/b.c index c400363..5671796 100644 --- a/b.c +++ b/b.c @@ -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 */ diff --git a/lex.c b/lex.c index 1c6a0b7..d729516 100644 --- a/lex.c +++ b/lex.c @@ -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 */ diff --git a/tran.c b/tran.c index 1fca361..d659cfa 100644 --- a/tran.c +++ b/tran.c @@ -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);