netapi32: Avoid buffer overrun in NetBTNameEncode.

Signed-off-by: Thomas Faber <thomas.faber@reactos.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Thomas Faber 2016-06-26 11:02:37 +02:00 committed by Alexandre Julliard
parent 2885170057
commit f53b2588af

View File

@ -171,7 +171,7 @@ static int NetBTNameEncode(const UCHAR *p, UCHAR *buffer)
if (!buffer) return 0;
buffer[len++] = NCBNAMSZ * 2;
for (i = 0; p[i] && i < NCBNAMSZ; i++)
for (i = 0; i < NCBNAMSZ && p[i]; i++)
{
buffer[len++] = ((p[i] & 0xf0) >> 4) + 'A';
buffer[len++] = (p[i] & 0x0f) + 'A';