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

Potential crash in log monitoring

    XMLWordPrintable

    Details

    • Type: Problem report
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 5.2.0alpha3
    • Fix Version/s: 5.2.0beta1, 5.2 (plan)
    • Component/s: Agent (G)
    • Labels:
      None
    • Environment:
      Ubuntu 20.04 via WLS2
    • Team:
      Team A
    • Sprint:
      Sprint 68 (Sep 2020)
    • Story Points:
      0.125

      Description

      Steps to reproduce:

      1. Check out latest master
        $ git branch -v
        * master dc91fd6 .......PS. [ZBX-18121] fixed SSH monitoring when compiled with libssh
        
      2. Build minimal agent
        ./bootstrap.sh && ./configure --enable-agent && make
        

      Result:

      In file included from logfiles.c:22:
      In function ‘split_string’,
          inlined from ‘split_filename’ at logfiles.c:204:17,
          inlined from ‘make_logfile_list’ at logfiles.c:1687:25,
          inlined from ‘process_logrt’ at logfiles.c:3007:24:
      ../../../include/log.h:69:4: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
         69 |    __zbx_zabbix_log(level, __VA_ARGS__);      \
            |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      logfiles.c:94:2: note: in expansion of macro ‘zabbix_log’
         94 |  zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%s part1:'%s' part2:'%s'", __func__, zbx_result_string(ret),
            |  ^~~~~~~~~~
      logfiles.c: In function ‘process_logrt’:
      logfiles.c:94:53: note: format string is defined here
         94 |  zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%s part1:'%s' part2:'%s'", __func__, zbx_result_string(ret),
            |                                                     ^~
      In file included from logfiles.c:22:
      In function ‘split_filename’,
          inlined from ‘make_logfile_list’ at logfiles.c:1687:25,
          inlined from ‘process_logrt’ at logfiles.c:3007:24:
      ../../../include/log.h:69:4: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
         69 |    __zbx_zabbix_log(level, __VA_ARGS__);      \
            |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      logfiles.c:229:2: note: in expansion of macro ‘zabbix_log’
        229 |  zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%s directory:'%s' filename_regexp:'%s'", __func__,
            |  ^~~~~~~~~~
      logfiles.c: In function ‘process_logrt’:
      logfiles.c:229:57: note: format string is defined here
        229 |  zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%s directory:'%s' filename_regexp:'%s'", __func__,
            |                                                         ^~
      
      $ gcc --version
      gcc (Ubuntu 9.3.0-10ubuntu2) 9.3.0
      Copyright (C) 2019 Free Software Foundation, Inc.
      This is free software; see the source for copying conditions.  There is NO
      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      

      Expected:
      It seems to me that GCC is making a valid point here. Around here directory is assigned NULL and is passed to split_filename() where it accidentally gets printed. On some platforms it can lead to crash.

        Attachments

          Activity

            People

            Assignee:
            viktors.tjarve Viktors Tjarve
            Reporter:
            cyclone Glebs Ivanovskis
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: