[ros-diffs] [tfaber] 54482: [SERVICES] - Do not use an unsigned type for a value that can become negative in ScmAssignNewTag (CID 14665)

tfaber at svn.reactos.org tfaber at svn.reactos.org
Wed Nov 23 18:15:27 UTC 2011


Author: tfaber
Date: Wed Nov 23 18:15:26 2011
New Revision: 54482

URL: http://svn.reactos.org/svn/reactos?rev=54482&view=rev
Log:
[SERVICES]
- Do not use an unsigned type for a value that can become negative in ScmAssignNewTag (CID 14665)

Modified:
    trunk/reactos/base/system/services/rpcserver.c

Modified: trunk/reactos/base/system/services/rpcserver.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/rpcserver.c?rev=54482&r1=54481&r2=54482&view=diff
==============================================================================
--- trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/rpcserver.c [iso-8859-1] Wed Nov 23 18:15:26 2011
@@ -271,7 +271,7 @@
     DWORD dwFreeTag = 0;
     DWORD dwTagUsedBase = 1;
     BOOLEAN TagUsed[TAG_ARRAY_SIZE];
-    DWORD dwTagOffset;
+    INT nTagOffset;
     DWORD i;
     DWORD cbDataSize;
     PLIST_ENTRY ServiceEntry;
@@ -333,9 +333,9 @@
         /* mark tags in GroupOrderList as used */
         for (i = 1; i <= dwGroupTagCount; i++)
         {
-            dwTagOffset = pdwGroupTags[i] - dwTagUsedBase;
-            if (dwTagOffset >= 0 && dwTagOffset < TAG_ARRAY_SIZE)
-                TagUsed[dwTagOffset] = TRUE;
+            nTagOffset = pdwGroupTags[i] - dwTagUsedBase;
+            if (nTagOffset >= 0 && nTagOffset < TAG_ARRAY_SIZE)
+                TagUsed[nTagOffset] = TRUE;
         }
 
         /* mark tags in service list as used */
@@ -346,9 +346,9 @@
             CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry);
             if (CurrentService->lpGroup == lpService->lpGroup)
             {
-                dwTagOffset = CurrentService->dwTag - dwTagUsedBase;
-                if (dwTagOffset >= 0 && dwTagOffset < TAG_ARRAY_SIZE)
-                    TagUsed[dwTagOffset] = TRUE;
+                nTagOffset = CurrentService->dwTag - dwTagUsedBase;
+                if (nTagOffset >= 0 && nTagOffset < TAG_ARRAY_SIZE)
+                    TagUsed[nTagOffset] = TRUE;
             }
 
             ServiceEntry = ServiceEntry->Flink;
@@ -365,8 +365,7 @@
         }
 
         dwTagUsedBase += TAG_ARRAY_SIZE;
-    }
-    while (!dwFreeTag);
+    } while (!dwFreeTag);
 
 cleanup:
     if (pdwGroupTags)




More information about the Ros-diffs mailing list