Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nil pointer deref when GetNodeRenderedConfigDiff() returns 404 #968

Conversation

chrismarget-j
Copy link
Collaborator

Calls to GetNodeRenderedConfigDiff() may return error due to 404 from the API.

#964 introduced a change which made these errors not fatal for the data source. We want to just return a null incremental config in those cases.

Unfortunately, the incremental config is returned via a *apstra.RenderDiff (a pointer), which is nil on 404. Because 964 causes us to not return, we go on to dereference a value within that nil struct pointer, leading to a crash.

This PR tightens up the preceding code a bit (disambiguates some stuff no longer needed since #964) and checks the pointer before attempting to dereference the config diff.

Closes #967

@chrismarget-j chrismarget-j linked an issue Nov 6, 2024 that may be closed by this pull request
@chrismarget-j chrismarget-j merged commit 29f741a into main Nov 6, 2024
1 check passed
@chrismarget-j chrismarget-j deleted the 967-nil-pointer-derek-when-incremental-config-not-available branch November 6, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nil pointer deref when incremental config not available
2 participants