check for NULL as argument to krb5_{prepend,set}_error_message functions
This commit is contained in:
@@ -59,6 +59,8 @@ krb5_clear_error_message(krb5_context context)
|
||||
* Set the context full error string for a specific error code.
|
||||
* The error that is stored should be internationalized.
|
||||
*
|
||||
* The if context is NULL, no error string is stored.
|
||||
*
|
||||
* @param context Kerberos 5 context
|
||||
* @param ret The error code
|
||||
* @param fmt Error string for the error code
|
||||
@@ -82,6 +84,8 @@ krb5_set_error_message(krb5_context context, krb5_error_code ret,
|
||||
/**
|
||||
* Set the context full error string for a specific error code.
|
||||
*
|
||||
* The if context is NULL, no error string is stored.
|
||||
*
|
||||
* @param context Kerberos 5 context
|
||||
* @param ret The error code
|
||||
* @param fmt Error string for the error code
|
||||
@@ -98,6 +102,9 @@ krb5_vset_error_message (krb5_context context, krb5_error_code ret,
|
||||
{
|
||||
int r;
|
||||
|
||||
if (context == NULL)
|
||||
return;
|
||||
|
||||
HEIMDAL_MUTEX_lock(context->mutex);
|
||||
if (context->error_string) {
|
||||
free(context->error_string);
|
||||
@@ -114,6 +121,8 @@ krb5_vset_error_message (krb5_context context, krb5_error_code ret,
|
||||
* Prepend the context full error string for a specific error code.
|
||||
* The error that is stored should be internationalized.
|
||||
*
|
||||
* The if context is NULL, no error string is stored.
|
||||
*
|
||||
* @param context Kerberos 5 context
|
||||
* @param ret The error code
|
||||
* @param fmt Error string for the error code
|
||||
@@ -137,6 +146,8 @@ krb5_prepend_error_message(krb5_context context, krb5_error_code ret,
|
||||
/**
|
||||
* Prepend the contexts's full error string for a specific error code.
|
||||
*
|
||||
* The if context is NULL, no error string is stored.
|
||||
*
|
||||
* @param context Kerberos 5 context
|
||||
* @param ret The error code
|
||||
* @param fmt Error string for the error code
|
||||
@@ -151,6 +162,10 @@ krb5_vprepend_error_message(krb5_context context, krb5_error_code ret,
|
||||
__attribute__ ((format (printf, 3, 0)))
|
||||
{
|
||||
char *str = NULL, *str2 = NULL;
|
||||
|
||||
if (context == NULL)
|
||||
return;
|
||||
|
||||
HEIMDAL_MUTEX_lock(context->mutex);
|
||||
if (context->error_code != ret) {
|
||||
HEIMDAL_MUTEX_unlock(context->mutex);
|
||||
|
Reference in New Issue
Block a user