Skip to content

Commit

Permalink
Don't panic if there is no onboard cert
Browse files Browse the repository at this point in the history
dev.Onboard can be nil, so we need to check for that before
accessing the cert.

Signed-off-by: Shahriyar Jalayeri <shahriyar@zededa.com>
  • Loading branch information
shjala committed Nov 18, 2024
1 parent 0e95654 commit 2524166
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/driver/file/device_manager_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,9 @@ func (d *DeviceManager) checkValidOnboardSerial(cert *x509.Certificate, serial s
func (d *DeviceManager) getOnboardSerialDevice(cert *x509.Certificate, serial string) *uuid.UUID {
certStr := string(cert.Raw)
for uid, dev := range d.devices {
if dev.Onboard == nil {
continue
}
dCertStr := string(dev.Onboard.Raw)
if dCertStr == certStr && serial == dev.Serial {
return &uid
Expand Down

0 comments on commit 2524166

Please sign in to comment.