Fix size computation in replace_repeat() for special_case REPEAT_WITH_Q.
authormillert <millert@openbsd.org>
Tue, 2 Mar 2021 20:41:42 +0000 (20:41 +0000)
committermillert <millert@openbsd.org>
Tue, 2 Mar 2021 20:41:42 +0000 (20:41 +0000)
commitff3903525f97a6db1dd79ea9146254871d5d996f
tree05b59805568ed4961cca3f05b801828e87167252
parentfefadbf1d302de8079a7ce7583f9eeec7aee7446
Fix size computation in replace_repeat() for special_case REPEAT_WITH_Q.
This resulted in the NUL terminator being written to the end of the
buffer which was not the same as the end of the string.  That in
turn caused garbage bytes from malloc() to be processed.  Also
change the NUL termination to be less error prone by writing the
NUL immediately after the last byte copied.  OK sthen@
usr.bin/awk/b.c