1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

libcli/smb: rely on the caller zero-initializing "lease" in smb2_lease_pull()

Doing the zero initialization per struct member just feels like a way for bugs
to creep in, even when leasev1 is not going to change ever. The only caller has
already zero-initialized state->lease twice via 1) __tevent_req_create() and 2)
a struct initializer of "state".

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Ralph Boehme 2024-10-21 12:48:19 +02:00
parent 0192401c8a
commit 2b1ef2d894

View File

@ -23,6 +23,11 @@
#include "includes.h"
#include "../libcli/smb/smb_common.h"
/**
* Pull a lease off the wire into a struct smb2_lease.
*
* Note: the caller MUST zero initialize "lease".
**/
ssize_t smb2_lease_pull(const uint8_t *buf, size_t len,
struct smb2_lease *lease)
{
@ -47,8 +52,6 @@ ssize_t smb2_lease_pull(const uint8_t *buf, size_t len,
switch (version) {
case 1:
ZERO_STRUCT(lease->parent_lease_key);
lease->lease_epoch = 0;
break;
case 2:
memcpy(&lease->parent_lease_key, buf+32, 16);