Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imdocker: Coverity-detected issues #3594

Open
rgerhards opened this issue Apr 5, 2019 · 0 comments
Open

imdocker: Coverity-detected issues #3594

rgerhards opened this issue Apr 5, 2019 · 0 comments
Labels

Comments

@rgerhards
Copy link
Member

unfortunately, Coverity scan can only be run "after the fact" and not as part of CI. So it now reports problem with imdocker, which has recently merged:


** CID 202689:  Control flow issues  (DEADCODE)
/contrib/imdocker/imdocker.c: 800 in dockerContainerInfoNew()


________________________________________________________________________________________________________
*** CID 202689:  Control flow issues  (DEADCODE)
/contrib/imdocker/imdocker.c: 800 in dockerContainerInfoNew()
794             docker_container_info_t* pThis = calloc(1, sizeof(docker_container_info_t));
795             CHKmalloc(pThis);
796             *ppThis = pThis;
797     
798     finalize_it:
799             if (iRet != RS_RET_OK && pThis) {
>>>     CID 202689:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "dockerContainerInfoDestruct...".
800                     dockerContainerInfoDestruct(pThis);
801             }
802             RETiRet;
803     }
804     
805     static void

** CID 202688:  Null pointer dereferences  (REVERSE_INULL)
/contrib/imdocker/imdocker.c: 1381 in imdocker_container_logs_curlCB()


________________________________________________________________________________________________________
*** CID 202688:  Null pointer dereferences  (REVERSE_INULL)
/contrib/imdocker/imdocker.c: 1381 in imdocker_container_logs_curlCB()
1375                    pDataBuf->bytes_remaining = 0;
1376                    write_size = realsize;
1377                    pread = pdata;
1378            }
1379     
1380            /* allocate the expected payload size */
>>>     CID 202688:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "pDataBuf" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
1381            if (pDataBuf) {
1382                    CHKiRet(dockerContLogsBufWrite(pDataBuf, pread, write_size));
1383                    if (pDataBuf->bytes_remaining == 0) {
1384                            DBGPRINTF("%s() - write size is same as payload_size\n", __FUNCTION__);
1385                            /* NOTE: We do see if a log line gets extended beyond 16K
1386                             * if (mem->data[mem->len-1] == imdocker_eol_char)

@n2yen can you have a look? I can enable full access to coverity, which usually is pretty helpful. Just request it. rsyslog homepage on Coverity: https://scan.coverity.com/projects/rsyslog-rsyslog

@rgerhards rgerhards added the bug label Apr 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant