Skip to content

dockerfile/parse: Fix nil dereference of a linter#4984

Closed
vvoland wants to merge 1 commit intomoby:masterfrom
vvoland:linter-nilcheck
Closed

dockerfile/parse: Fix nil dereference of a linter#4984
vvoland wants to merge 1 commit intomoby:masterfrom
vvoland:linter-nilcheck

Conversation

@vvoland
Copy link
Collaborator

@vvoland vvoland commented Jun 3, 2024

Fix a nil dereference panic happening when parsing ENV and LABEL commands without a linter introduced by 6cfa459.

Signed-off-by: Paweł Gronowski [email protected]

Fix a nil dereference panic happening when parsing `ENV` and `LABEL`
commands without a linter introduced by
6cfa459.

Signed-off-by: Paweł Gronowski <[email protected]>
if sep == "" {
if lint != nil && sep == "" {
msg := linter.RuleLegacyKeyValueFormat.Format(cmdName)
lint.Run(&linter.RuleLegacyKeyValueFormat, location, msg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe safer to do this check in the lint.Run() method, but that can be future follow-up.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably find a way to make it so calling linter methods is always valid. I think this is good to just take care of the current issue though.

if sep == "" {
if lint != nil && sep == "" {
msg := linter.RuleLegacyKeyValueFormat.Format(cmdName)
lint.Run(&linter.RuleLegacyKeyValueFormat, location, msg)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably find a way to make it so calling linter methods is always valid. I think this is good to just take care of the current issue though.

vvoland added a commit to vvoland/moby that referenced this pull request Jun 4, 2024
Signed-off-by: Paweł Gronowski <[email protected]>
@tonistiigi tonistiigi closed this Jun 5, 2024
@thompson-shaun thompson-shaun removed this from the v0.14.0 milestone Jun 5, 2024
@thompson-shaun
Copy link
Collaborator

Replaced by #4996

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants