From 26cea49f1a65b8d63bb4d985676cb6c5cc8fa00c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 16 Jan 2018 11:08:35 -0500 Subject: [PATCH] handle nulls in event_prefix and label_format in Monitor::Reload --- src/zm_monitor.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 4faa377f4..928b253e0 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1727,8 +1727,20 @@ void Monitor::Reload() { function = (Function)atoi(dbrow[index++]); enabled = atoi(dbrow[index++]); const char *p_linked_monitors = dbrow[index++]; - strncpy( event_prefix, dbrow[index++], sizeof(event_prefix)-1 ); - strncpy( label_format, dbrow[index++], sizeof(label_format)-1 ); + + if ( dbrow[index] ) { + strncpy( event_prefix, dbrow[index++], sizeof(event_prefix)-1 ); + } else { + event_prefix[0] = 0; + index++; + } + if ( dbrow[index] ) { + strncpy( label_format, dbrow[index++], sizeof(label_format)-1 ); + } else { + label_format[0] = 0; + index++; + } + label_coord = Coord( atoi(dbrow[index]), atoi(dbrow[index+1]) ); index += 2; label_size = atoi(dbrow[index++]); warmup_count = atoi(dbrow[index++]);