#740 Properly check error values in error_string()
Closed 7 years ago Opened 13 years ago by sgallagh.

#define IS_HASH_ERROR(error)  (((error) >= HASH_ERROR_BASE) && ((error) < HASH_ERROR_LIMIT))

const char *error_string(int error)
{
    if (IS_HASH_ERROR(error))
        return hash_error_string(error);

    return strerror(error);
}

IS_HASH_ERROR is not sufficient to guarantee that we haven't still received a negative value here. error_string() should check {{{error < 0}}} and return "Unknown error"


Fields changed

coverity: 10034 => 10035

Fields changed

coverity: 10034 => 10035

Fields changed

coverity: 10034 => 10035

Fields changed

coverity: 10035 => 10035, 10036, 10037, 10038, 10039, 10040

Fields changed

coverity: 10035 => 10035, 10036, 10037, 10038, 10039, 10040

Fields changed

coverity: 10035 => 10035, 10036, 10037, 10038, 10039, 10040

Hash errors are negative so the check should be like this:

const char *error_string(int error) {

    if (IS_HASH_ERROR(error))
        return hash_error_string(error);

    if (error < 0) return "Unknown error"); 
    else return strerror(error);

}

Hash errors are negative so the check should be like this:

const char *error_string(int error) {

    if (IS_HASH_ERROR(error))
        return hash_error_string(error);

    if (error < 0) return "Unknown error"); 
    else return strerror(error);

}

Hash errors are negative so the check should be like this:

const char *error_string(int error) {

    if (IS_HASH_ERROR(error))
        return hash_error_string(error);

    if (error < 0) return "Unknown error"); 
    else return strerror(error);

}

Fields changed

rhbz: => 0

Fields changed

rhbz: => 0

Fields changed

rhbz: => 0

Fields changed

blockedby: =>
blocking: =>
feature_milestone: =>
milestone: Tools Backlog => Tools 2.0
patch: => 0

Fields changed

blockedby: =>
blocking: =>
feature_milestone: =>
milestone: Tools Backlog => Tools 2.0
patch: => 0

Fields changed

blockedby: =>
blocking: =>
feature_milestone: =>
milestone: Tools Backlog => Tools 2.0
patch: => 0

Metadata Update from @sgallagh:
- Issue assigned to sbose
- Issue set to the milestone: Tools 2.0

7 years ago

Metadata Update from @lslebodn:
- Custom field component reset
- Custom field patch reset
- Custom field testsupdated reset
- Custom field type reset
- Custom field version reset
- Issue close_status updated to: None

7 years ago

Metadata Update from @lslebodn:
- Custom field patch reset
- Custom field testsupdated reset
- Issue status updated to: Closed (was: Open)

7 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/1782

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