Commit 65a4ba2
committed
fix: pass sanitized search to _do_search and guard $to_cache writes
Two bugs fixed:
1. _sanitize_search() result was never propagated back to %opts,
so _do_search() received the original unsanitized user input.
This bypassed newline removal, quote escaping, and character
whitelisting before the search reached git grep.
2. In _run_child_git_grep(), lines 925-926 wrote to $to_cache
unconditionally, but the filehandle is only initialized when
$cache_file is set. This would crash the child process with
"Can't use an undefined value as a filehandle" when caching
is disabled.
Also removes unused $gitdir variable in do_search().1 parent a8e8eec commit 65a4ba2
1 file changed
+6
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
250 | | - | |
251 | 249 | | |
| 250 | + | |
252 | 251 | | |
253 | 252 | | |
254 | 253 | | |
| |||
922 | 921 | | |
923 | 922 | | |
924 | 923 | | |
925 | | - | |
926 | | - | |
927 | | - | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
928 | 929 | | |
929 | 930 | | |
930 | 931 | | |
| |||
0 commit comments