memsetw(): fix mistake where the 'word' value would get written byteswapped

on i386, resulting in ' ' being encoded incorrectly in session
setup query - just use memcpy() as rest of code, it DTRT for both LE and
BE machines in this case,  since the function is called with 'word'
in little-endian format

Many thanks to Martin Husemann for testing on i386 and sparc64 against
both w2k and Samba.
This commit is contained in:
jdolecek 2003-03-28 13:08:00 +00:00
parent 2d45e41adb
commit cd7975662e
1 changed files with 2 additions and 6 deletions

View File

@ -145,12 +145,8 @@ nb_encname_len(const char *str)
static void
memsetw(char *dst, int n, u_short word)
{
unsigned char c2 = word & 0x00ff;
unsigned char c1 = (word>>8) & 0x00ff;
while (n--) {
*dst++ = c1;
*dst++ = c2;
}
for(; n > 0; n--, dst += 2)
memcpy(dst, &word, 2);
}
int