Jeff King writes:
> This is not the first time I've seen this chomp/trim distinction come
> up. However, the thing that has prevented me from writing strbuf_chomp
> is that the trim is almost always a more reasonable choice.
> ...
> End mini-rant. :)
Thanks.
--
To unsubscribe from this list: sen
On Wed, Jan 28, 2015 at 12:42:26PM -0800, Junio C Hamano wrote:
> > This is the most minimal fix, but I kind of wonder if it should just be
> > using strbuf_rtrim (or even strbuf_trim) in the first place.
>
> Yeah. Or strbuf_chomp(), which does not exist ;-)
This is not the first time I've seen
When we are chomping newlines from the end of a strbuf, we
must check "sb.len != 0" before accessing "sb.buf[sb.len - 1]".
However, this code mistakenly checks "&sb.len", which is
always true (it is a part of an auto struct, so the address
is always non-zero). This could lead to us accessing memory
Jeff King writes:
> When we are chomping newlines from the end of a strbuf, we
> must check "sb.len != 0" before accessing "sb.buf[sb.len - 1]".
> However, this code mistakenly checks "&sb.len", which is
> always true (it is a part of an auto struct, so the address
> is always non-zero). This cou
4 matches
Mail list logo