Changeset: 008e77a72705 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=008e77a72705 Modified Files: monetdb5/modules/atoms/str.c Branch: alloc-less-str Log Message:
Always include null terminator, use strcpy_len instead of strncpy diffs (25 lines): diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c --- a/monetdb5/modules/atoms/str.c +++ b/monetdb5/modules/atoms/str.c @@ -4300,6 +4300,7 @@ str_substitute(str *buf, size_t *buflen, if (repeat && ldst > lsrc) n = (ldst * l) / lsrc; /* max length */ + n++; CHECK_STR_BUFFER_LENGTH(buf, buflen, n, "str.substitute"); b = *buf; pfnd = s; @@ -4309,11 +4310,11 @@ str_substitute(str *buf, size_t *buflen, break; n = fnd - pfnd; if (n > 0) { - strncpy(b, pfnd, n); + strcpy_len(b, pfnd, n + 1); b += n; } if (ldst > 0) { - strncpy(b, dst, ldst); + strcpy_len(b, dst, ldst + 1); b += ldst; } if (*fnd == 0) _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list