server: Avoid memcpy with null pointer (Clang).

This commit is contained in:
Alexandre Julliard 2024-09-11 17:12:27 +02:00
parent c8e069470f
commit 5b1b85960e
2 changed files with 14 additions and 15 deletions

View file

@ -468,12 +468,15 @@ DECL_HANDLER(get_clipboard_data)
if (req->cached && req->seqno == format->seqno) goto done; /* client-side cache still valid */ if (req->cached && req->seqno == format->seqno) goto done; /* client-side cache still valid */
if (format->size > get_reply_max_size()) if (format->data)
{ {
set_error( STATUS_BUFFER_OVERFLOW ); if (format->size > get_reply_max_size())
return; {
set_error( STATUS_BUFFER_OVERFLOW );
return;
}
set_reply_data( format->data, format->size );
} }
set_reply_data( format->data, format->size );
done: done:
if (!req->render) clipboard->rendering--; if (!req->render) clipboard->rendering--;

View file

@ -1549,25 +1549,21 @@ DECL_HANDLER(get_token_default_dacl)
{ {
struct token *token; struct token *token;
reply->acl_len = 0; if (!(token = (struct token *)get_handle_obj( current->process, req->handle,
TOKEN_QUERY, &token_ops )))
return;
if ((token = (struct token *)get_handle_obj( current->process, req->handle, if (token->default_dacl)
TOKEN_QUERY,
&token_ops )))
{ {
if (token->default_dacl) reply->acl_len = token->default_dacl->size;
reply->acl_len = token->default_dacl->size;
if (reply->acl_len <= get_reply_max_size()) if (reply->acl_len <= get_reply_max_size())
{ {
struct acl *acl_reply = set_reply_data_size( reply->acl_len ); struct acl *acl_reply = set_reply_data_size( reply->acl_len );
if (acl_reply) if (acl_reply) memcpy( acl_reply, token->default_dacl, reply->acl_len );
memcpy( acl_reply, token->default_dacl, reply->acl_len );
} }
else set_error( STATUS_BUFFER_TOO_SMALL ); else set_error( STATUS_BUFFER_TOO_SMALL );
release_object( token );
} }
release_object( token );
} }
DECL_HANDLER(set_token_default_dacl) DECL_HANDLER(set_token_default_dacl)