SUSE / linux-security-sensor

Linux security sensor
Other
18 stars 9 forks source link

hash: fix nil pointer dereference panic #86

Closed djoreilly closed 7 months ago

djoreilly commented 7 months ago

When newHashResultCacheEntry() failed the returned nil pointer was assigned to the entry interface. Later entry!=nil would evaluate to true and try to use it. Fix by setting entry to nil when newHashResultCacheEntry() fails.

Fixes https://github.com/SUSE/linux-security-sensor/issues/85

djoreilly commented 7 months ago

Another way to fix this would be to change the signature of newHashResultCacheEntry() so it returns HashResultCacheEntry - maybe that was the original intention.

https://stackoverflow.com/a/62441926