Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 6d7c0b3

Browse files
committed
Security: clear defaults for config file names (cf. #2170).
1 parent e3a819c commit 6d7c0b3

File tree

13 files changed

+56
-80
lines changed

13 files changed

+56
-80
lines changed

autoload/syntastic/c.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ function! s:_get_cflags(ft, ck, opts) abort " {{{2
228228
endif
229229

230230
" add optional config file parameters
231-
let config_file = s:_get_checker_var('g', a:ft, a:ck, 'config_file', '.syntastic_' . a:ft . '_config')
231+
let config_file = s:_get_checker_var('b', a:ft, a:ck, 'config_file', s:_get_checker_var('g', a:ft, a:ck, 'config_file', ''))
232232
let flags .= ' ' . syntastic#c#ReadConfig(config_file)
233233

234234
if b_cflags ==# '' && (a:ft ==# 'c' || a:ft ==# 'cpp') && !s:_get_checker_var('g', a:ft, a:ck, 'no_include_search', 0)

doc/syntastic-checkers.txt

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ linter.
234234

235235
*'g:syntastic_ada_config_file'*
236236
Type: string
237-
Default: ".syntastic_ada_config"
237+
Default: unset
238238
File containing additional compilation flags to be passed to the linter, one
239239
option per line (cf. |syntastic-config-files|).
240240

@@ -453,7 +453,7 @@ assembler. Set it to something like "-mtune=native": >
453453
<
454454
*'g:syntastic_asm_config_file'*
455455
Type: string
456-
Default: ".syntastic_asm_config"
456+
Default: unset
457457
File containing additional compilation flags to be passed to the assembler,
458458
one option per line (see |syntastic-config-files|).
459459

@@ -559,7 +559,7 @@ Additionally:
559559

560560
*'g:syntastic_avrgcc_config_file'*
561561
Type: string
562-
Default: ".syntastic_avrgcc_config"
562+
Default: unset
563563
File containing compilation flags (such as defines or include directories),
564564
one option per line (cf. |syntastic-config-files|).
565565

@@ -600,7 +600,7 @@ Additionally:
600600

601601
*'g:syntastic_clang_check_config_file'*
602602
Type: string
603-
Default: ".syntastic_clang_check_config"
603+
Default: unset
604604
File containing compilation flags (such as defines or include directories),
605605
one option per line (cf. |syntastic-config-files|).
606606

@@ -651,7 +651,7 @@ Additionally:
651651

652652
*'g:syntastic_clang_tidy_config_file'*
653653
Type: string
654-
Default: ".syntastic_clang_tidy_config"
654+
Default: unset
655655
File containing compilation flags (such as defines or include directories),
656656
one option per line (cf. |syntastic-config-files|).
657657

@@ -693,7 +693,7 @@ Additionally:
693693

694694
*'g:syntastic_cppcheck_config_file'*
695695
Type: string
696-
Default: ".syntastic_cppcheck_config"
696+
Default: unset
697697
File containing compilation flags (such as defines or include directories),
698698
one option per line (cf. |syntastic-config-files|).
699699

@@ -782,7 +782,7 @@ linter.
782782

783783
*'g:syntastic_c_config_file'*
784784
Type: string
785-
Default: ".syntastic_c_config"
785+
Default: unset
786786
File containing additional compilation flags to be passed to the linter, one
787787
option per line (cf. |syntastic-config-files|).
788788

@@ -876,7 +876,7 @@ Additionally:
876876

877877
'g:syntastic_oclint_config_file'
878878
Type: string
879-
Default: ".syntastic_oclint_config"
879+
Default: unset
880880
File containing compilation flags (such as defines or include directories),
881881
one option per line (cf. |syntastic-config-files|).
882882

@@ -917,7 +917,7 @@ Additionally:
917917

918918
*'g:syntastic_pc_lint_config_file'*
919919
Type: string
920-
Default: "options.lnt"
920+
Default: unset
921921
Name of an indirect (.lnt) file. A file with that name is looked up in the
922922
current directory and in parent directories; first such file found is used.
923923

@@ -942,7 +942,7 @@ Additionally:
942942

943943
*'g:syntastic_sparse_config_file'*
944944
Type: string
945-
Default: ".syntastic_sparse_config"
945+
Default: unset
946946
File containing compilation flags (such as defines or include directories),
947947
one option per line (cf. |syntastic-config-files|).
948948

@@ -975,7 +975,7 @@ Additionally:
975975

976976
*'g:syntastic_splint_config_file'*
977977
Type: string
978-
Default: ".syntastic_splint_config"
978+
Default: unset
979979
File containing project-specific options to be passed to "Splint"
980980
(such as defines or include directories), one option per line (cf.
981981
|syntastic-config-files|).
@@ -1035,7 +1035,7 @@ Additionally:
10351035

10361036
'g:syntastic_avrgcc_config_file'
10371037
Type: string
1038-
Default: ".syntastic_avrgcc_config"
1038+
Default: unset
10391039
File containing compilation flags (such as defines or include directories),
10401040
one option per line (cf. |syntastic-config-files|).
10411041

@@ -1062,7 +1062,7 @@ Additionally:
10621062

10631063
'g:syntastic_clang_check_config_file'
10641064
Type: string
1065-
Default: ".syntastic_clang_check_config"
1065+
Default: unset
10661066
file containing compilation flags (such as defines or include directories),
10671067
one option per line (cf. |syntastic-config-files|).
10681068

@@ -1113,7 +1113,7 @@ Additionally:
11131113

11141114
'g:syntastic_clang_tidy_config_file'
11151115
Type: string
1116-
Default: ".syntastic_clang_tidy_config"
1116+
Default: unset
11171117
File containing compilation flags (such as defines or include directories),
11181118
one option per line (cf. |syntastic-config-files|).
11191119

@@ -1155,7 +1155,7 @@ Additionally:
11551155

11561156
'g:syntastic_cppcheck_config_file'
11571157
Type: string
1158-
Default: ".syntastic_cppcheck_config"
1158+
Default: unset
11591159
File containing compilation flags (such as defines or include directories),
11601160
one option per line (cf. |syntastic-config-files|).
11611161

@@ -1280,7 +1280,7 @@ linter.
12801280

12811281
*'g:syntastic_cpp_config_file'*
12821282
Type: string
1283-
Default: ".syntastic_cpp_config"
1283+
Default: unset
12841284
File containing additional compilation flags to be passed to the linter, one
12851285
option per line (cf. |syntastic-config-files|).
12861286

@@ -1363,7 +1363,7 @@ Additionally:
13631363

13641364
'g:syntastic_oclint_config_file'
13651365
Type: string
1366-
Default: ".syntastic_oclint_config"
1366+
Default: unset
13671367
File containing compilation flags (such as defines or include directories),
13681368
one option per line (cf. |syntastic-config-files|).
13691369

@@ -1405,7 +1405,7 @@ Additionally:
14051405

14061406
'g:syntastic_pc_lint_config_file'
14071407
Type: string
1408-
Default: "options.lnt"
1408+
Default: unset
14091409
Name of an indirect (.lnt) file. A file with that name is looked up in the
14101410
current directory and in parent directories; first such file found is used.
14111411

@@ -1431,7 +1431,7 @@ Additionally:
14311431

14321432
*'g:syntastic_verapp_config_file'*
14331433
Type: string
1434-
Default: ".syntastic_verapp_config"
1434+
Default: unset
14351435
File containing additional compilation flags to be passed to the linter, one
14361436
option per line (cf. |syntastic-config-files|).
14371437

@@ -1562,7 +1562,7 @@ Compilation flags (such as "-std=cobol2002") to be passed to the linter.
15621562

15631563
*'g:syntastic_cobol_config_file'*
15641564
Type: string
1565-
Default: ".syntastic_cobol_config"
1565+
Default: unset
15661566
File containing additional compilation flags to be passed to the linter, one
15671567
option per line (cf. |syntastic-config-files|).
15681568

@@ -1905,7 +1905,7 @@ Example: >
19051905
<
19061906
*'g:syntastic_cuda_config_file'*
19071907
Type: string
1908-
Default: ".syntastic_cuda_config"
1908+
Default: unset
19091909
File containing additional compilation flags to be passed to the linter, one
19101910
option per line (cf. |syntastic-config-files|).
19111911

@@ -1950,7 +1950,7 @@ linter.
19501950

19511951
*'g:syntastic_d_config_file'*
19521952
Type: string
1953-
Default: ".syntastic_d_config"
1953+
Default: unset
19541954
File containing additional compilation flags to be passed to the linter, one
19551955
option per line (cf. |syntastic-config-files|).
19561956

@@ -2342,7 +2342,7 @@ Compilation flags (such as "-std=f95") to be passed to the linter.
23422342

23432343
*'g:syntastic_fortran_config_file'*
23442344
Type: string
2345-
Default: ".syntastic_fortran_config"
2345+
Default: unset
23462346
File containing additional compilation flags to be passed to the linter, one
23472347
option per line (cf. |syntastic-config-files|).
23482348

@@ -4349,7 +4349,7 @@ linter.
43494349

43504350
*'g:syntastic_objc_config_file'*
43514351
Type: string
4352-
Default: ".syntastic_objc_config"
4352+
Default: unset
43534353
File containing additional compilation flags to be passed to the linter, one
43544354
option per line (cf. |syntastic-config-files|).
43554355

@@ -4413,7 +4413,7 @@ Additionally:
44134413

44144414
'g:syntastic_oclint_config_file'
44154415
Type: string
4416-
Default: ".syntastic_oclint_config"
4416+
Default: unset
44174417
File containing compilation flags (such as defines or include directories),
44184418
one option per line (cf. |syntastic-config-files|).
44194419

@@ -4460,7 +4460,7 @@ linter.
44604460

44614461
*'g:syntastic_objcpp_config_file'*
44624462
Type: string
4463-
Default: ".syntastic_objcpp_config"
4463+
Default: unset
44644464
File containing additional compilation flags to be passed to the linter, one
44654465
option per line (cf. |syntastic-config-files|).
44664466

@@ -4524,7 +4524,7 @@ Additionally:
45244524

45254525
'g:syntastic_oclint_config_file'
45264526
Type: string
4527-
Default: ".syntastic_oclint_config"
4527+
Default: unset
45284528
File containing compilation flags (such as defines or include directories),
45294529
one option per line (cf. |syntastic-config-files|).
45304530

@@ -7030,7 +7030,7 @@ linter.
70307030

70317031
*'g:syntastic_verilog_config_file'*
70327032
Type: string
7033-
Default: ".syntastic_verilog_config"
7033+
Default: unset
70347034
File containing additional compilation flags to be passed to the linter, one
70357035
option per line (cf. |syntastic-config-files|).
70367036

plugin/syntastic.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if has('reltime')
1919
lockvar! g:_SYNTASTIC_START
2020
endif
2121

22-
let g:_SYNTASTIC_VERSION = '3.8.0-110'
22+
let g:_SYNTASTIC_VERSION = '3.8.0-113'
2323
lockvar g:_SYNTASTIC_VERSION
2424

2525
" Sanity checks {{{1

syntax_checkers/c/avrgcc.vim

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,16 @@ if exists('g:loaded_syntastic_c_avrgcc_checker')
1515
endif
1616
let g:loaded_syntastic_c_avrgcc_checker = 1
1717

18-
if !exists('g:syntastic_avrgcc_config_file')
19-
let g:syntastic_avrgcc_config_file = '.syntastic_avrgcc_config'
20-
endif
21-
2218
let s:save_cpo = &cpo
2319
set cpo&vim
2420

2521
let s:opt_x = { 'c': 'c', 'cpp': 'c++' }
2622

2723
function! SyntaxCheckers_c_avrgcc_GetLocList() dict
24+
let buf = bufnr('')
25+
2826
let makeprg = self.makeprgBuild({
29-
\ 'args_before': syntastic#c#ReadConfig(g:syntastic_avrgcc_config_file),
27+
\ 'args_before': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'avrgcc_config_file')),
3028
\ 'args_after': '-x ' . get(s:opt_x, self.getFiletype(), '') . ' -fsyntax-only' })
3129

3230
let errorformat =

syntax_checkers/c/clang_check.vim

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ if exists('g:loaded_syntastic_c_clang_check_checker')
1414
endif
1515
let g:loaded_syntastic_c_clang_check_checker = 1
1616

17-
if !exists('g:syntastic_clang_check_config_file')
18-
let g:syntastic_clang_check_config_file = '.syntastic_clang_check_config'
19-
endif
20-
2117
if !exists('g:syntastic_c_clang_check_sort')
2218
let g:syntastic_c_clang_check_sort = 1
2319
endif
@@ -26,10 +22,12 @@ let s:save_cpo = &cpo
2622
set cpo&vim
2723

2824
function! SyntaxCheckers_c_clang_check_GetLocList() dict
25+
let buf = bufnr('')
26+
2927
let makeprg = self.makeprgBuild({
3028
\ 'post_args':
3129
\ '-- ' .
32-
\ syntastic#c#ReadConfig(g:syntastic_clang_check_config_file) . ' ' .
30+
\ syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'clang_check_config_file')) . ' ' .
3331
\ '-fshow-column ' .
3432
\ '-fshow-source-location ' .
3533
\ '-fno-caret-diagnostics ' .

syntax_checkers/c/clang_tidy.vim

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ if exists('g:loaded_syntastic_c_clang_tidy_checker')
1414
endif
1515
let g:loaded_syntastic_c_clang_tidy_checker = 1
1616

17-
if !exists('g:syntastic_clang_tidy_config_file')
18-
let g:syntastic_clang_tidy_config_file = '.syntastic_clang_tidy_config'
19-
endif
20-
2117
if !exists('g:syntastic_c_clang_tidy_sort')
2218
let g:syntastic_c_clang_tidy_sort = 1
2319
endif
@@ -26,10 +22,12 @@ let s:save_cpo = &cpo
2622
set cpo&vim
2723

2824
function! SyntaxCheckers_c_clang_tidy_GetLocList() dict
25+
let buf = bufnr('')
26+
2927
let makeprg = self.makeprgBuild({
3028
\ 'post_args':
3129
\ '-- ' .
32-
\ syntastic#c#ReadConfig(g:syntastic_clang_tidy_config_file) . ' ' .
30+
\ syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'clang_tidy_config_file')) . ' ' .
3331
\ '-fshow-column ' .
3432
\ '-fshow-source-location ' .
3533
\ '-fno-caret-diagnostics ' .

syntax_checkers/c/cppcheck.vim

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ if exists('g:loaded_syntastic_c_cppcheck_checker')
1414
endif
1515
let g:loaded_syntastic_c_cppcheck_checker = 1
1616

17-
if !exists('g:syntastic_cppcheck_config_file')
18-
let g:syntastic_cppcheck_config_file = '.syntastic_cppcheck_config'
19-
endif
20-
2117
let s:save_cpo = &cpo
2218
set cpo&vim
2319

2420
function! SyntaxCheckers_c_cppcheck_GetLocList() dict
21+
let buf = bufnr('')
22+
2523
let makeprg = self.makeprgBuild({
26-
\ 'args': syntastic#c#ReadConfig(g:syntastic_cppcheck_config_file),
24+
\ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'cppcheck_config_file')),
2725
\ 'args_after': '-q --enable=style' })
2826

2927
let errorformat =

syntax_checkers/c/oclint.vim

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ if exists('g:loaded_syntastic_c_oclint_checker')
1414
endif
1515
let g:loaded_syntastic_c_oclint_checker = 1
1616

17-
if !exists('g:syntastic_oclint_config_file')
18-
let g:syntastic_oclint_config_file = '.syntastic_oclint_config'
19-
endif
20-
2117
if !exists('g:syntastic_c_oclint_sort')
2218
let g:syntastic_c_oclint_sort = 1
2319
endif
@@ -26,8 +22,10 @@ let s:save_cpo = &cpo
2622
set cpo&vim
2723

2824
function! SyntaxCheckers_c_oclint_GetLocList() dict
25+
let buf = bufnr('')
26+
2927
let makeprg = self.makeprgBuild({
30-
\ 'post_args': '-- -c ' . syntastic#c#ReadConfig(g:syntastic_oclint_config_file) })
28+
\ 'post_args': '-- -c ' . syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'oclint_config_file') })
3129

3230
let errorformat =
3331
\ '%E%f:%l:%c: fatal error: %m,' .

syntax_checkers/c/pc_lint.vim

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@ let g:loaded_syntastic_c_pc_lint_checker = 1
1818
let s:save_cpo = &cpo
1919
set cpo&vim
2020

21-
if !exists('g:syntastic_pc_lint_config_file')
22-
let g:syntastic_pc_lint_config_file = 'options.lnt'
23-
endif
24-
2521
function! SyntaxCheckers_c_pc_lint_GetLocList() dict
2622
let buf = bufnr('')
27-
let config = syntastic#util#findFileInParent(g:syntastic_pc_lint_config_file, fnamemodify(bufname(buf), ':p:h'))
23+
let config = syntastic#util#findFileInParent(syntastic#util#bufVar(buf, 'pc_lint_config_file'), fnamemodify(bufname(buf), ':p:h'))
2824
call self.log('config =', config)
2925

3026
" -hFs1 - show filename, add space after messages, try to make message 1 line

0 commit comments

Comments
 (0)