[NTGDI] Fix stack memory disclosure in ftGdiGetTextMetricsW (#2991)
authorNguyen Trung Khanh <nguyentrungkhanh97@gmail.com>
Tue, 25 Aug 2020 16:28:39 +0000 (23:28 +0700)
committerGitHub <noreply@github.com>
Tue, 25 Aug 2020 16:28:39 +0000 (19:28 +0300)
win32ss/gdi/ntgdi/freetype.c

index c53bf1a..79c825f 100644 (file)
@@ -4560,6 +4560,7 @@ ftGdiGetTextMetricsW(
         EngSetLastError(STATUS_INVALID_PARAMETER);
         return FALSE;
     }
+    RtlZeroMemory(ptmwi, sizeof(TMW_INTERNAL));
 
     if (!(dc = DC_LockDc(hDC)))
     {
@@ -4612,7 +4613,6 @@ ftGdiGetTextMetricsW(
                 FillTM(&ptmwi->TextMetric, FontGDI, pOS2, pHori, !Error ? &Win : 0);
 
                 /* FIXME: Fill Diff member */
-                RtlZeroMemory(&ptmwi->Diff, sizeof(ptmwi->Diff));
             }
 
             IntUnLockFreeType();