fix: null-check StorageId column in Monitor::Load to prevent segfault

dbrow[col] for StorageId can be NULL when the database column contains
a NULL value. Passing NULL to atoi causes a segfault in strtol.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Isaac Connor
2026-03-30 09:13:50 -04:00
parent df594cac62
commit 1ec9c449b4

View File

@@ -388,7 +388,7 @@ void Monitor::Load(MYSQL_ROW dbrow, bool load_zones=true, Purpose p = QUERY) {
server_id = dbrow[col] ? atoi(dbrow[col]) : 0;
col++;
storage_id = atoi(dbrow[col]);
storage_id = dbrow[col] ? atoi(dbrow[col]) : 0;
col++;
delete storage;
storage = new Storage(storage_id);