From 8b64c9ce1f863f0520a5cb2cd50abfa36b02876c Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 30 May 2015 10:24:29 +0000 Subject: [PATCH] [NETAPI32] Fix array index use before limits check. By Kudratov Olimjon using Cppcheck. CORE-8978 svn path=/trunk/; revision=67965 --- reactos/dll/win32/netapi32/nbt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reactos/dll/win32/netapi32/nbt.c b/reactos/dll/win32/netapi32/nbt.c index ba68e7206da..6a33a716c5a 100644 --- a/reactos/dll/win32/netapi32/nbt.c +++ b/reactos/dll/win32/netapi32/nbt.c @@ -163,7 +163,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';