Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] pretty: avoid buffer overflow in format_person_part

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:53

Jeff King [off-list ref] writes:
A more ideal solution would be for mailmap to grow an
interface that:

  1. Takes a pointer and length combination, instead of
     assuming a NUL-terminated string.

  2. Returns a pointer to the mailmap's allocated string,
     rather than copying it into the buffer.
I was looking at René's patch to refs codepath that converted some "we
allocate because callee wants to have NUL-terminated strings" functions to
take counted strings (or whatever we want to call it---perhaps "string
slices"?), and it appears that we may benefit if more callers that do not
have to own strings that comes to them used them instead of NUL-terminated
strings as their interface.  At some deep point near the leaf of the
callchain, they may need to be converted in order to call external API
(read: POSIX) that takes NUL-terminated strings, but internal callchain
like the mailmap one, if done carefully, should let us avoid extra
allocations.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help