[ZBX-11300] Wrong variable used when processing "mode" parameter of forecast() function Created: 2016 Oct 01  Updated: 2017 May 30  Resolved: 2016 Oct 03

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 3.0.6rc1, 3.2.2rc1, 3.4.0alpha1
Fix Version/s: 3.0.6rc1, 3.2.2rc1, 3.4.0alpha1

Type: Incident report Priority: Trivial
Reporter: Glebs Ivanovskis (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: codequality
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Found by Coverity (CID 153297) as uninitialized variable mode usage, but actually mode is used instead of mode_str. Fix is trivial:

Index: src/libs/zbxalgo/prediction.c
===================================================================
--- src/libs/zbxalgo/prediction.c	(revision 62923)
+++ src/libs/zbxalgo/prediction.c	(working copy)
@@ -908,7 +908,7 @@
 
 int	zbx_mode_code(char *mode_str, zbx_mode_t *mode, char **error)
 {
-	if ('\0' == *mode || 0 == strcmp(mode_str, "value"))
+	if ('\0' == *mode_str || 0 == strcmp(mode_str, "value"))
 	{
 		*mode = MODE_VALUE;
 	}


 Comments   
Comment by Alexander Vladishev [ 2016 Oct 01 ]

Successfully tested!

Comment by dimir [ 2016 Oct 03 ]

Fixed in

  • pre-3.0.6rc1 (r62933)
  • pre-3.2.2rc1 (r62934)
  • pre-3.3.0 (r62935)
Generated at Thu Apr 25 16:08:51 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.