mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 13:14:22 +01:00
safer out of bounds (#1135)
This commit is contained in:
1 parent
9c6650d14a
commit
56079dc9ea
1 file changed
+7
@@ -122,7 +122,14 @@ func printFinding(f report.Finding) {
|
|||||||
Italic(true).
|
Italic(true).
|
||||||
Foreground(lipgloss.Color("#f05c07"))
|
Foreground(lipgloss.Color("#f05c07"))
|
||||||
matchEnd := lipgloss.NewStyle().SetString(f.Match[secretInMatchIdx+len(f.Secret):]).Foreground(lipgloss.Color("#f5d445"))
|
matchEnd := lipgloss.NewStyle().SetString(f.Match[secretInMatchIdx+len(f.Secret):]).Foreground(lipgloss.Color("#f5d445"))
|
||||||
|
|
||||||
|
lineEndIdx := matchInLineIDX + len(f.Match)
|
||||||
|
if len(f.Line)-1 <= lineEndIdx {
|
||||||
|
lineEndIdx = len(f.Line) - 1
|
||||||
|
}
|
||||||
|
|
||||||
lineEnd := f.Line[matchInLineIDX+len(f.Match):]
|
lineEnd := f.Line[matchInLineIDX+len(f.Match):]
|
||||||
|
|
||||||
if len(f.Secret) > 100 {
|
if len(f.Secret) > 100 {
|
||||||
secret = lipgloss.NewStyle().SetString(f.Secret[0:100] + "...").
|
secret = lipgloss.NewStyle().SetString(f.Secret[0:100] + "...").
|
||||||
Bold(true).
|
Bold(true).
|
||||||
|
|||||||
Reference in new issue
Block a user