Re: [PATCH] mailinfo.c::convert_to_utf8: reuse strlen info
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 18, 2020, 23:12 UTC
- Message-ID
- <xmqqk12ctmm1.fsf@gitster.c.googlers.com>
- In-Reply-To
- <CAN0heSppn6BBX4V1T1qgKc4XP+8i6qbcEqd1_3NqWQtZJLaJww@mail.gmail.com>
Martin Ågren <martin.agren@gmail.com> writes:
> This is equivalent as long as `line->len` is equal to > `strlen(line->buf)`, which it will be (should be) because it's a > strbuf. Ok.
For the guarantee to hold true, line->buf[0..line->len] should not have any '\0' byte in it.
This helper has two callers, but in either case, it needs to be prepared to work on output of decode_[bq]_segment(). Is there code anywhere that guarntees that the decoding won't stuff '\0' in the line?