Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-15107

Incorrect error handling in compile_filename_regexp() if file name regexp does not compile in logrt[], logrt.count[] items

    Details

    • Team:
      Team A
    • Sprint:
      Sprint 46, Nov 2018
    • Story Points:
      0.125

      Description

      If a logrt[] or logrt.count[] item is used with incorrect regular expression for file name (e.g. logrt[/home/zabbix40/test.log.*\,.*]') then compile_filename_regexp() prints a part of error message from uninitialized buffer.

      For example in frontend user might see:

      Cannot compile a regular expression describing filename pattern: Б́
      

      instead of

      Cannot compile a regular expression describing filename pattern: \ at end of pattern
      

      Possible fix:

      Index: src/zabbix_agent/logfiles.c
      ===================================================================
      --- src/zabbix_agent/logfiles.c	(revision 86279)
      +++ src/zabbix_agent/logfiles.c	(working copy)
      @@ -1533,8 +1533,8 @@
        *                                                                            *
        * Parameters:                                                                *
        *     filename_regexp - [IN] regexp to be compiled                           *
      - *     re              - [OUT] compiled regexp                             *
      - *     err_msg         - [OUT] error message why regexp could not be       *
      + *     re              - [OUT] compiled regexp                                *
      + *     err_msg         - [OUT] error message why regexp could not be          *
        *                       compiled                                             *
        *                                                                            *
        * Return value: SUCCEED or FAIL                                              *
      @@ -1546,10 +1546,8 @@
       
       	if (SUCCEED != zbx_regexp_compile(filename_regexp, re, &regexp_err))
       	{
      -		char	err_buf[MAX_STRING_LEN];
      -
       		*err_msg = zbx_dsprintf(*err_msg, "Cannot compile a regular expression describing filename pattern: %s",
      -				err_buf);
      +				regexp_err);
       		return FAIL;
       	}
      

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                andris Andris Mednis
                Reporter:
                andris Andris Mednis
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: