mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
r11038: r10351@SERNOX: metze | 2005-09-20 16:11:17 +0200
fix namebuf_len, when type is 0x00
metze
(This used to be commit 1b2effa01b
)
This commit is contained in:
parent
2ecb46d595
commit
b3d0ac41db
@ -169,13 +169,19 @@ static NTSTATUS wreplsrv_record2wins_name(TALLOC_CTX *mem_ctx, struct wrepl_wins
|
|||||||
}
|
}
|
||||||
|
|
||||||
namebuf = (uint8_t *)talloc_asprintf(mem_ctx, "%-15s%c%s",
|
namebuf = (uint8_t *)talloc_asprintf(mem_ctx, "%-15s%c%s",
|
||||||
rec->name->name, rec->name->type,
|
rec->name->name, 'X',
|
||||||
(rec->name->scope?rec->name->scope:""));
|
(rec->name->scope?rec->name->scope:""));
|
||||||
NT_STATUS_HAVE_NO_MEMORY(namebuf);
|
NT_STATUS_HAVE_NO_MEMORY(namebuf);
|
||||||
namebuf_len = strlen((char *)namebuf) + 1;
|
namebuf_len = strlen((char *)namebuf) + 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* we need to set the type here, and use a place-holder in the talloc_asprintf()
|
||||||
|
* as the type can be 0x00, and then the namebuf_len = strlen(namebuf); would give wrong results
|
||||||
|
*/
|
||||||
|
namebuf[15] = rec->name->type;
|
||||||
|
|
||||||
/* oh wow, what a nasty bug in windows ... */
|
/* oh wow, what a nasty bug in windows ... */
|
||||||
if (namebuf[15] == 0x1b && namebuf_len >= 16) {
|
if (rec->name->type == 0x1b) {
|
||||||
namebuf[15] = namebuf[0];
|
namebuf[15] = namebuf[0];
|
||||||
namebuf[0] = 0x1b;
|
namebuf[0] = 0x1b;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user