#1046 debug-tests.c coverity issues: NEGATIVE_RETURNS, FORWARD_NULL
Closed: Fixed None Opened 9 years ago by pbrezina.

CID 11033: Argument cannot be negative (NEGATIVE_RETURNS)Function "test_helper_debug_check_message(levels[i], 0)" returns a negative number.
Assigning: signed variable "result" = "test_helper_debug_check_message".
 452        result = test_helper_debug_check_message(levels[i], 0);
 453
"result" is passed to a parameter that cannot be negative.
 454        error_msg = strerror(result);



CID 11017: Argument cannot be negative (NEGATIVE_RETURNS)Function "test_helper_debug_check_message(levels[i], 0)" returns a negative number.
Assigning: signed variable "result" = "test_helper_debug_check_message".
 409        result = test_helper_debug_check_message(levels[i], 0);
 410
"result" is passed to a parameter that cannot be negative.
 411        error_msg = strerror(result);



CID 11016: Argument cannot be negative (NEGATIVE_RETURNS)Function "test_helper_debug_check_message(levels[i], 0)" returns a negative number.
Assigning: signed variable "result" = "test_helper_debug_check_message".
 371        result = test_helper_debug_check_message(levels[i], 0);
 372
"result" is passed to a parameter that cannot be negative.
 373        error_msg = strerror(result);



CID 11015: Argument cannot be negative (NEGATIVE_RETURNS)Function "ftell(file)" returns a negative number.
Assigning: signed variable "filesize" = "ftell".
 222    filesize = ftell(file);
 223
 224    rewind(file);
 225
 226    msg = talloc_array(ctx, char, filesize+1);
At conditional (1): "msg == NULL" taking the false branch.
 227    if (msg == NULL) {
 228        ret = ENOMEM;
 229        goto done;
 230    }
"filesize" is passed to a parameter that cannot be negative.
 231    fsize = fread(msg, sizeof(char), filesize, file);



Passing null variable "file" to function "fclose", which dereferences it.
 299    fclose(file);



Passing null variable "file" to function "fclose", which dereferences it.
 341    fclose(file);

Fields changed

coverity: => 11033, 11017, 11016, 11015
keywords: => Coverity

Fields changed

owner: somebody => pbrezina
status: new => assigned

Fields changed

milestone: NEEDS_TRIAGE => SSSD 1.7.0

Fields changed

patch: 0 => 1

Fields changed

coverity: 11033, 11017, 11016, 11015 => 11033, 11017, 11016, 11015, 11014, 11013

Fixed by d56e06f

resolution: => fixed
status: assigned => closed

Fields changed

rhbz: => 0

Metadata Update from @pbrezina:
- Issue assigned to pbrezina
- Issue set to the milestone: SSSD 1.7.0

3 years ago

SSSD is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in SSSD's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/SSSD/sssd/issues/2088

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Login to comment on this ticket.

Metadata