Skip to content

Commit

Permalink
Add extra NULL checks in smb2_set_[domain|workstation]
Browse files Browse the repository at this point in the history
From bdodge <[email protected]>

Signed-off-by: Ronnie Sahlberg <[email protected]>
  • Loading branch information
sahlberg committed Dec 27, 2024
1 parent 22c6086 commit 1899df3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,10 @@ void smb2_set_domain(struct smb2_context *smb2, const char *domain)
{
if (smb2->domain) {
free(discard_const(smb2->domain));
smb2->domain = NULL;
}
if (domain == NULL) {
return;
}
smb2->domain = strdup(domain);
}
Expand All @@ -672,6 +676,10 @@ void smb2_set_workstation(struct smb2_context *smb2, const char *workstation)
{
if (smb2->workstation) {
free(discard_const(smb2->workstation));
smb2->workstation = NULL;
}
if (workstation == NULL) {
return;
}
smb2->workstation = strdup(workstation);
}
Expand Down

0 comments on commit 1899df3

Please sign in to comment.