diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-12-04 15:24:29 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-03-05 13:59:22 -0800 |
commit | 2edc7308d6185d724f38e602520617121ef57672 (patch) | |
tree | e598047fb272d457992553f4ce27e57059d6daa0 /source3/smbd/smb2_server.c | |
parent | adaf517c87db22cb5b74906d43cfbae74a07130c (diff) | |
download | samba-2edc7308d6185d724f38e602520617121ef57672.tar.gz samba-2edc7308d6185d724f38e602520617121ef57672.tar.xz samba-2edc7308d6185d724f38e602520617121ef57672.zip |
s3:smb2_server: avoid talloc_zero_array() in smbd_smb2_request_error_ex()
It is only important that the content of info->data stays alive
for the lifetime of the request, but the DATA_BLOB structure itself
can be on the stack, while passing it as 'dyn' to smbd_smb2_request_done_ex().
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd/smb2_server.c')
-rw-r--r-- | source3/smbd/smb2_server.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index becbbed6647..cda36221557 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -2632,6 +2632,7 @@ NTSTATUS smbd_smb2_request_error_ex(struct smbd_smb2_request *req, const char *location) { DATA_BLOB body; + DATA_BLOB _dyn; uint8_t *outhdr = SMBD_SMB2_OUT_HDR_PTR(req); size_t unread_bytes = smbd_smb2_unread_bytes(req); @@ -2673,12 +2674,7 @@ NTSTATUS smbd_smb2_request_error_ex(struct smbd_smb2_request *req, * *MUST BE* OUTVEC_ALLOC_SIZE. So we have room for * 1 byte without having to do an alloc. */ - info = talloc_zero_array(req->out.vector, - DATA_BLOB, - 1); - if (!info) { - return NT_STATUS_NO_MEMORY; - } + info = &_dyn; info->data = ((uint8_t *)outhdr) + OUTVEC_ALLOC_SIZE - 1; info->length = 1; |