[ZBX-4527] alerter commandline truncated to 2048 chars when using alertscript Created: 2012 Jan 09  Updated: 2017 May 30  Resolved: 2012 Jul 24

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 1.8.10
Fix Version/s: 1.8.15rc1, 2.0.3rc1, 2.1.0

Type: Incident report Priority: Minor
Reporter: Pavel Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: actions
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by ZBX-4904 Cannot exec AlertScript Closed

 Description   

When alerter sends email via alertscript (custom media type, script), it pass destination address, subject and body as commandline arguments.
Total length of commandline limited to MAX_STRING_LEN=2048. When exceeded (for example, if item has big value such as web-page content) it's stripped and error ocured: "sh: Syntax error: Unterminated quoted string". I'm not sure it's documented behavior.
It will be good if commandline will be unlimited (allocated with malloc()) or message body pass via stdin (not as argument) or call alerter via exec() and not using "sh -c".



 Comments   
Comment by richlv [ 2012 Jan 09 ]

related to ZBX-1298

Comment by Kodai Terashima [ 2012 Feb 14 ]

We have to increase but_size in zbx_execute (src/libs/zbxexec/execute.c, line 247) as well. Over 64KB characters cannot be used for external scripts (only after 1.8.8).

If users use

{ESC.HISTORY}

macro in notification message, it's easy to exceed the 64KB limit.

<Sasha> The buffer in zbx_execute() uses only for script output. In alerter - only in a debug output.

Comment by Alexander Vladishev [ 2012 Jul 24 ]

Fixed in the development branch svn://svn.zabbix.com/branches/dev/ZBX-4527

Comment by dimir [ 2012 Aug 01 ]

Tested, works like a charm.

Comment by Alexander Vladishev [ 2012 Aug 01 ]

Fixed in pre-1.8.15 r29345, pre-2.0.3 r29346 and pre-2.1.0 (trunk) r29347.

Generated at Thu Apr 25 14:44:32 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.