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

Possible use of uninitialized variable when reporting elastic history backend error

    Details

    • Type: Problem report
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 3.4.14, 4.0.1, 4.2.0alpha1
    • Fix Version/s: 4.0.2rc1, 4.2.0alpha1, 4.2 (plan)
    • Component/s: Server (S)
    • Labels:
      None
    • Team:
      Team A
    • Sprint:
      Sprint 46, Nov 2018
    • Story Points:
      0.5

      Description

      ** CID 184231:  Error handling issues  (CHECKED_RETURN)
      /src/libs/zbxhistory/history_elastic.c: 485 in elastic_writer_flush()
      
      
      ________________________________________________________________________________________________________
      *** CID 184231:  Error handling issues  (CHECKED_RETURN)
      /src/libs/zbxhistory/history_elastic.c: 485 in elastic_writer_flush()
      479                                                             " message: %s", curl_page->errbuf);
      480                                     }
      481                                     else
      482                                     {
      483                                             long int        err;
      484     
      >>>     CID 184231:  Error handling issues  (CHECKED_RETURN)
      >>>     Calling "curl_easy_getinfo" without checking return value (as is done elsewhere 8 out of 10 times).
      485                                             curl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE, &err);
      486                                             zabbix_log(LOG_LEVEL_ERR, "cannot send data to elasticsearch, HTTP error code:"
      487                                                             " %ld", err);
      488                                     }
      489                             }
      490                             else if (CURLE_OK != msg->data.result)
      
      ** CID 184229:  Error handling issues  (CHECKED_RETURN)
      /src/libs/zbxhistory/history_elastic.c: 200 in elastic_log_error()
      
      
      ________________________________________________________________________________________________________
      *** CID 184229:  Error handling issues  (CHECKED_RETURN)
      /src/libs/zbxhistory/history_elastic.c: 200 in elastic_log_error()
      194     static void     elastic_log_error(CURL *handle, CURLcode error, const char *errbuf)
      195     {
      196             long    http_code;
      197     
      198             if (CURLE_HTTP_RETURNED_ERROR == error)
      199             {
      >>>     CID 184229:  Error handling issues  (CHECKED_RETURN)
      >>>     Calling "curl_easy_getinfo" without checking return value (as is done elsewhere 8 out of 10 times).
      200                     curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &http_code);
      201     
      202                     if (0 != page_r.offset)
      203                     {
      204                             zabbix_log(LOG_LEVEL_ERR, "cannot get values from elasticsearch, HTTP error: %ld, message: %s",
      205                                             http_code, page_r.data);
      

      According to libcurl documentation curl_easy_getinfo with CURLINFO_RESPONSE_CODE:

      Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.

      Not sure if it's possible for it to return error in our setup, but better to handle it.

        Attachments

          Activity

            People

            • Assignee:
              MVekslers Michael Veksler
              Reporter:
              wiper Andris Zeila
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: