-
Incident report
-
Resolution: Fixed
-
Minor
-
1.8.6, 1.8.7, 1.8.8
When item with multi byte character in key is created or updated ,Error messages display.
I found that is equal to 'S_INVALID_KEY_FORMAT'(define).
== Error messages ==
Title: ERROR: Cannot add item
Details: Error in item key: Invalid item key format.
Title: ERROR: Cannot update item
Details: Error in item key: Invalid item key format.
Item Detail is below.
== Item details ==
Host: Zabbix server
Type: Zabbix agent(active)
Keys: log[/var/log/messages,'???',"UTF-8",100]
Type of information: Log
I found detail message at ./api/classes/class.citemkey.php in 319.
End of key "]" is not judged in this function.I would.
== class.citemkey.php ==
104 private function parseKeyParameters(){
.....
140 // for every byte, starting after '['
141 for($this->currentByte+; $this->currentByte < $this->keyByteCnt; $this->currentByte+) {
142 switch($this->state){
143 // initial state
144 case 0:
.....
191 // all nestings are closed correctly
192 if ($this->nestLevel == 0 && isset($this->key[$this->currentByte+1]) && $this->key[$this->currentByte+1] == ']' && !isset($this->key[$this->currentByte+2]))
195
.....
315 break;
316 }
317 }
318 $this->isValid = false;
319 $this->error = S_INVALID_KEY_FORMAT;
== Try to find a cause ==
I consider to be caused by mb_strlen override strlen.
Mb_strlen returns number not of byte but of character.It's too small than byte of key.
"for loop"in 141 cannnot reach end of key "]".I would.
Affecting Apache configration is found.
But this param needs for JP package to work.
- cat /etc/httpd/conf.d/zabbix.conf
php_value mbstring.func_overload 6
== A provisional avoiding ==
Modify class.citemkey.php
57c57
< $this->keyByteCnt = strlen($this->key);
—
> $this->keyByteCnt = strlen(bin2hex($this->key)) / 2;
Regards.