Commit 7f6f3df
committed
revparse: fix parsing bug for trailing
When parsing a revspec that ends with a trailing `@`, explicitly stop
parsing. Introduce a sentinel variable to explicitly stop parsing.
Prior to this, we would set `spec` to `HEAD`, but were looping on the
value of `spec[pos]`, so we would continue walking the (new) `spec`
at offset `pos`, looking for a NUL. This is obviously an out-of-bounds
read.
Credit to Michael Rodler (@f0rki) and Amazon AWS Security.@
1 parent d298b02 commit 7f6f3df
1 file changed
+4
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
| 704 | + | |
704 | 705 | | |
705 | 706 | | |
706 | 707 | | |
| |||
710 | 711 | | |
711 | 712 | | |
712 | 713 | | |
713 | | - | |
| 714 | + | |
714 | 715 | | |
715 | 716 | | |
716 | 717 | | |
| |||
817 | 818 | | |
818 | 819 | | |
819 | 820 | | |
| 821 | + | |
| 822 | + | |
820 | 823 | | |
821 | 824 | | |
822 | 825 | | |
| |||
0 commit comments