Commit a2faf0c
committed
index: fix use-after-free in add_conflict()
IndexEntry._to_c() returns both the git_index_entry struct and the
CFFI-allocated char[] that centry.path points to. add_conflict()
was discarding the char[] reference with `_`, so CFFI freed the path
string while centry.path still pointed to it. When
git_index_conflict_add() read the dangling pointer, it copied garbage
into the index (observed as EEEE... on hardened allocators).
Keep the path references alive until after the C function returns.
Fixes #14171 parent 5acab24 commit a2faf0c
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
| 258 | + | |
259 | 259 | | |
260 | | - | |
| 260 | + | |
261 | 261 | | |
262 | | - | |
| 262 | + | |
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
| |||
0 commit comments