Skip to content

Commit

Permalink
Treat nil value on SecurityContext.ReadOnlyRootFilesystem as false
Browse files Browse the repository at this point in the history
Add nil check when dereferencing SecurityContext.ReadOnlyRootFilesystem.
This should fix a nil pointer dereference reported by a customer.

Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
welteki committed Nov 17, 2023
1 parent ffa794c commit bc569a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,10 @@ func readFunctions(deps []v1.Deployment) []Function {
function.Limits = lim

if functionContainer.SecurityContext != nil {
function.ReadOnlyRootFilesystem = *functionContainer.SecurityContext.ReadOnlyRootFilesystem
if functionContainer.SecurityContext.ReadOnlyRootFilesystem != nil {
function.ReadOnlyRootFilesystem = *functionContainer.SecurityContext.ReadOnlyRootFilesystem
}
function.ReadOnlyRootFilesystem = false
}

functions = append(functions, function)
Expand Down

0 comments on commit bc569a6

Please sign in to comment.