[krbdev.mit.edu #7087] AutoReply: [BUG krb5-1.10] krb5_gss_get_name_attribute

Ian Abbott via RT rt-comment at krbdev.mit.edu
Mon Feb 6 06:38:43 EST 2012


>         if (display_value != NULL) {
>             if (code != 0)
>                 code = data_to_gss(&kdisplay_value, display_value);
>             else
>                 free(kdisplay_value.data);
>         }

Also, in the same region of code:

If the call data_to_gss(&kdisplay_value, display_value) fails with an
error (which can only happen #ifdef _WIN32), the preceding call
data_to_gss(&kvalue, value) has now passed responsibility for the buffer
value->value to the caller even though krb5_gss_get_name_attribute() is
returning a failure code.  In this case, one solution would be to free
value->value, and since kvalue now has empty data, repeat the call
data_to_gss(&kvalue, value) which shouldn't fail as it shouldn't have to
allocate anything.

        if (display_value != NULL) {
            if (code == 0) {
                code = data_to_gss(&kdisplay_value, display_value);
                if (code != 0 && value != NULL) {
                    /* Cleanup.  N.B. kvalue is empty_data() */
                    free(value->value);
                    data_to_gss(&kvalue, value);
                }
            }
            else
                free(kdisplay_value.data);
        }



More information about the krb5-bugs mailing list