1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

s3/lib: use talloc_alpha_strcpy() in set_remote_machine_name()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Ralph Boehme 2020-01-17 19:30:01 +01:00 committed by Andreas Schneider
parent 1a8e6271c6
commit e3cd8e46b3

View File

@ -94,7 +94,6 @@ bool set_remote_machine_name(const char *remote_name, bool perm)
{
static bool already_perm = False;
char *tmp_remote_machine;
size_t len;
if (already_perm) {
return true;
@ -107,16 +106,12 @@ bool set_remote_machine_name(const char *remote_name, bool perm)
trim_char(tmp_remote_machine,' ',' ');
TALLOC_FREE(remote_machine);
len = strlen(tmp_remote_machine);
remote_machine = (char *)TALLOC_ZERO(NULL, len+1);
if (!remote_machine) {
TALLOC_FREE(tmp_remote_machine);
remote_machine = talloc_alpha_strcpy(NULL,
tmp_remote_machine,
SAFE_NETBIOS_CHARS);
if (remote_machine == NULL) {
return false;
}
/* alpha_strcpy includes the space for the terminating nul. */
alpha_strcpy(remote_machine,tmp_remote_machine,
SAFE_NETBIOS_CHARS,len+1);
if (!strlower_m(remote_machine)) {
TALLOC_FREE(tmp_remote_machine);
return false;