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

Use of uninitialized variable reported by Coverity

    XMLWordPrintable

    Details

      Description

      In src/zabbix_server/httppoller/httptest.c if curl_easy_init() returns NULL and SQL query returns nothing (although THIS_SHOULD_NEVER_HAPPEN) we use uninitialized httpstep in the log message (CID118961):

      static void	process_httptest(DC_HOST *host, zbx_httptest_t *httptest)
      {
      ...
      	DB_HTTPSTEP	httpstep;
      ...
      	if (NULL == (easyhandle = curl_easy_init()))
      	{
      		err_str = zbx_strdup(err_str, "cannot initialize cURL library");
      		goto clean;
      	}
      ...
      clean:
      	curl_easy_cleanup(easyhandle);
      ...
      	if (NULL != err_str)
      	{
      		if (0 == lastfailedstep)
      		{
      			/* we are here either because cURL initialization failed */
      			/* or we have been compiled without cURL library */
      
      			lastfailedstep = 1;
      
      			if (NULL != (row = DBfetch(result)))
      			{
      				ZBX_STR2UINT64(httpstep.httpstepid, row[0]);
      				httpstep.name = row[2];
      
      				memset(&stat, 0, sizeof(stat));
      
      				process_step_data(httpstep.httpstepid, &stat, &ts);
      			}
      			else
      				THIS_SHOULD_NEVER_HAPPEN;
      		}
      
      		zabbix_log(LOG_LEVEL_WARNING, "cannot process step \"%s\" of web scenario \"%s\" on host \"%s\": %s",
      				httpstep.name, httptest->httptest.name, host->name, err_str);
      	}
      ...
      

      Also, to my understanding it's not obligatory to do curl_easy_cleanup(NULL).

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            glebs.ivanovskis Glebs Ivanovskis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: