Commit 8fbe2df
strbuf: replace strbuf_grow() in strbuf_attach() with BUG() check
strbuf_attach() documents that alloc must be larger than len, as the
buffer must have room for the NUL terminator. Replace the strbuf_grow(sb, 0)
call, which was silently reallocating when alloc <= len, with an explicit
BUG() to enforce this contract and write the NUL terminator directly.
Signed-off-by: Vaidas Pilkauskas <vaidas.pilkauskas@shopify.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent a41c247 commit 8fbe2df
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
102 | | - | |
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| |||
0 commit comments