This makes Coverity happier about not treating a char as an array.
For now this is a pointer to a 0, but could as well become a pointer
that crashes if dereferenced. Shouldn't be NULL anyway because clang's
-fsanitize=nonnull-attribute will complain about them.
return FALSE;
auth_request_log_info(auth_request, "passdb", "%s", error);
pass_callback(PASSDB_RESULT_USER_UNKNOWN,
- &uchar_nul, 0, auth_request);
+ uchar_empty_ptr, 0, auth_request);
} else if (conn->userdb_restricted_uid != 0) {
/* no permissions to do this lookup */
auth_request_log_error(auth_request, "passdb",
"Auth client doesn't have permissions to do "
"a PASS lookup: %s", auth_restricted_reason(conn));
pass_callback(PASSDB_RESULT_INTERNAL_FAILURE,
- &uchar_nul, 0, auth_request);
+ uchar_empty_ptr, 0, auth_request);
} else {
auth_request_set_state(auth_request,
AUTH_REQUEST_STATE_MECH_CONTINUE);
i_assert(auth_request->state == AUTH_REQUEST_STATE_FINISHED);
auth_request_handler_reply(auth_request,
AUTH_CLIENT_RESULT_FAILURE,
- &uchar_nul, 0);
+ uchar_empty_ptr, 0);
auth_request_unref(&auth_request);
}
}
"passdb doesn't support credential lookups");
auth_request_lookup_credentials_callback(
PASSDB_RESULT_SCHEME_NOT_AVAILABLE,
- &uchar_nul, 0, request);
+ uchar_empty_ptr, 0, request);
} else if (passdb->passdb->blocking) {
passdb_blocking_lookup_credentials(request);
} else {
const unsigned char *data, size_t data_size)
{
if (data == NULL) {
- auth_request_handler_reply_continue(request, &uchar_nul, 0);
+ auth_request_handler_reply_continue(request, uchar_empty_ptr, 0);
} else {
/* initial reply given, even if it was 0 bytes */
request->mech->auth_continue(request, data, data_size);
} else {
static_credentials_callback(
PASSDB_RESULT_SCHEME_NOT_AVAILABLE,
- &uchar_nul, 0, auth_request);
+ uchar_empty_ptr, 0, auth_request);
}
} else {
static_lookup_real(auth_request, callback);
} else {
/* we want to save only literal size, not the literal itself. */
parser->literal_size_return = TRUE;
- imap_parser_save_arg(parser, &uchar_nul, 0);
+ imap_parser_save_arg(parser, uchar_empty_ptr, 0);
return FALSE;
}
}
switch (client->state) {
case STATE_INIT:
- *output_r = &uchar_nul;
+ *output_r = uchar_empty_ptr;
*output_len_r = 0;
return 0;
case STATE_USER:
if (_stream->skip >= _stream->pos) {
*size_r = 0;
- return &uchar_nul;
+ return uchar_empty_ptr;
}
if (i_stream_is_buffer_invalid(_stream)) {
_stream->skip = _stream->pos = 0;
stream->eof = FALSE;
}
- return &uchar_nul;
+ return uchar_empty_ptr;
}
*size_r = _stream->pos - _stream->skip;
};
const unsigned char uchar_nul = '\0';
+const unsigned char *uchar_empty_ptr = { 0 };
int i_snprintf(char *dest, size_t max_chars, const char *format, ...)
{
#define MAX_INT_STRLEN ((sizeof(uintmax_t) * CHAR_BIT + 2) / 3 + 1)
extern const unsigned char uchar_nul; /* (const unsigned char *)"" */
+extern const unsigned char *uchar_empty_ptr; /* non-NULL pointer that shouldn't be dereferenced. */
/* Returns -1 if dest wasn't large enough, 0 if not. */
int i_snprintf(char *dest, size_t max_chars, const char *format, ...)