diff --git a/frontends/php/include/classes/api/services/CMaintenance.php b/frontends/php/include/classes/api/services/CMaintenance.php
index 8e8600f58c..48309ed11f 100644
--- a/frontends/php/include/classes/api/services/CMaintenance.php
+++ b/frontends/php/include/classes/api/services/CMaintenance.php
@@ -629,6 +629,10 @@ class CMaintenance extends CApiService {
 						}
 					}
 
+					if (array_key_exists('every', $timeperiod) && $timeperiod['every'] <= 0) {
+						self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect maintenance period: "every"'));
+					}
+
 					// Without "timeperiod_type" it resolves to default TIMEPERIOD_TYPE_ONETIME. But will it be forever?
 					if ($timeperiod_type === null) {
 						$timeperiod_type = DB::getDefault('timeperiods', 'timeperiod_type');
diff --git a/src/libs/zbxdbcache/dbconfig_maintenance.c b/src/libs/zbxdbcache/dbconfig_maintenance.c
index 324a498656..29730c2bd0 100644
--- a/src/libs/zbxdbcache/dbconfig_maintenance.c
+++ b/src/libs/zbxdbcache/dbconfig_maintenance.c
@@ -264,7 +264,7 @@ void	DCsync_maintenance_periods(zbx_dbsync_t *sync)
 	zbx_uint64_t			periodid, maintenanceid;
 	zbx_dc_maintenance_period_t	*period;
 	zbx_dc_maintenance_t		*maintenance;
-	int				found, ret, index;
+	int				found, ret, index, tmp;
 
 	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
 
@@ -287,6 +287,15 @@ void	DCsync_maintenance_periods(zbx_dbsync_t *sync)
 		period = (zbx_dc_maintenance_period_t *)DCfind_id(&config->maintenance_periods, periodid,
 				sizeof(zbx_dc_maintenance_period_t), &found);
 
+		tmp = atoi(row[2]);
+
+		if (0 >= tmp)
+		{
+			zabbix_log(LOG_LEVEL_WARNING, "cannot process maintenance maintenanceid: \"" ZBX_FS_UI64 "\":"
+					" time period field \"every\" has invalid value %d", maintenanceid, tmp);
+			continue;
+		}
+
 		period->maintenanceid = maintenanceid;
 		ZBX_STR2UCHAR(period->type, row[1]);
 		period->every = atoi(row[2]);
