[NETAPI32] Fix array index use before limits check. By Kudratov Olimjon using Cppchec...
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 30 May 2015 10:24:29 +0000 (10:24 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 30 May 2015 10:24:29 +0000 (10:24 +0000)
svn path=/trunk/; revision=67965

reactos/dll/win32/netapi32/nbt.c

index ba68e72..6a33a71 100644 (file)
@@ -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';