From 1ec9c449b4f79faac3e68d2d3328b2f45dab99ea Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 30 Mar 2026 09:13:50 -0400 Subject: [PATCH] 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) --- src/zm_monitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index ff2b92be4..27a080ca3 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -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);