Fix a buffer overflow. Thanks to Christoph for spotting this.
authorGed Murphy <gedmurphy@reactos.org>
Sat, 7 Jan 2006 19:14:03 +0000 (19:14 +0000)
committerGed Murphy <gedmurphy@reactos.org>
Sat, 7 Jan 2006 19:14:03 +0000 (19:14 +0000)
svn path=/trunk/; revision=20665

reactos/subsys/system/servman/query.c

index 7cfb2e2..2052cbe 100644 (file)
@@ -39,7 +39,7 @@ RefreshServiceList(VOID)
     {\r
         HICON hiconItem;     /* icon for list-view items */\r
         HIMAGELIST hSmall;   /* image list for other views */\r
     {\r
         HICON hiconItem;     /* icon for list-view items */\r
         HIMAGELIST hSmall;   /* image list for other views */\r
-        TCHAR buf[40];\r
+        TCHAR buf[256];\r
 \r
         /* Create the icon image lists */\r
         hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),\r
 \r
         /* Create the icon image lists */\r
         hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),\r
@@ -85,14 +85,8 @@ RefreshServiceList(VOID)
 \r
             ZeroMemory(&item, sizeof(LV_ITEM));\r
             item.mask = LVIF_TEXT;\r
 \r
             ZeroMemory(&item, sizeof(LV_ITEM));\r
             item.mask = LVIF_TEXT;\r
-            item.iImage = 0;\r
             item.pszText = pServiceStatus[Index].lpDisplayName;\r
             item.pszText = pServiceStatus[Index].lpDisplayName;\r
-            /*_tcsncpy(item.pszText,\r
-                    pServiceStatus[Index].lpDisplayName,                    \r
-                    sizeof(pServiceStatus[Index].lpDisplayName));*/\r
-\r
             item.iItem = ListView_GetItemCount(hListView);\r
             item.iItem = ListView_GetItemCount(hListView);\r
-            item.lParam = 0;\r
             item.iItem = ListView_InsertItem(hListView, &item);\r
 \r
             \r
             item.iItem = ListView_InsertItem(hListView, &item);\r
 \r
             \r
@@ -137,7 +131,12 @@ RefreshServiceList(VOID)
 \r
                 HeapFree(GetProcessHeap(), 0, Description);\r
             }\r
 \r
                 HeapFree(GetProcessHeap(), 0, Description);\r
             }\r
-            \r
+            else\r
+            {\r
+                item.pszText = '\0';\r
+                item.iSubItem = 1;\r
+                SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);\r
+            }            \r
 \r
 \r
             /* set the status */\r
 \r
 \r
             /* set the status */\r