[PATCH 0/1] MR1773: localui: Add additional safety check (Coverity)
Should not change the logic, but makes Coverity happy and seems safer Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1773
From: Fabian Maurer <dark.shadow4(a)web.de> Should not change the logic, but makes Coverity happy and seems safer Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de> --- dlls/localui/localui.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/localui/localui.c b/dlls/localui/localui.c index 643b01d7b3f..5823fc88fa4 100644 --- a/dlls/localui/localui.c +++ b/dlls/localui/localui.c @@ -85,8 +85,10 @@ static BOOL dlg_configure_com(HANDLE hXcv, HWND hWnd, PCWSTR pPortName) DWORD len; BOOL res; - /* strip the colon (pPortName is never empty here) */ + /* strip the colon (pPortName should never empty be here) */ len = lstrlenW(pPortName); + if (!len) + return FALSE; shortname = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (shortname) { memcpy(shortname, pPortName, (len -1) * sizeof(WCHAR)); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/1773
I think it would be better to just mark this as a false positive in Coverity. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1773#note_19432
Since I found it hard to follow the code to guarantee this assumption, I figured it wouldn't hurt to add an additional safety check. If you consider it fine as is, please feel free to reject this MR. PS: I'm a bit hesitant to mark stuff as false-positive in coverity, just in case I'm wrong... -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1773#note_19467
So, should that be closed? Or does it have merit? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1773#note_19821
On Mon Dec 19 01:15:46 2022 +0000, Fabian Maurer wrote:
So, should that be closed? Or does it have merit? My vote is to close the merge request and mark the defect as a false positive in Coverity.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/1773#note_19825
On Mon Dec 19 01:15:46 2022 +0000, Alex Henrie wrote:
My vote is to close the merge request and mark the defect as a false positive in Coverity. Okay!
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/1773#note_19827
This merge request was closed by Fabian Maurer. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/1773
participants (3)
-
Alex Henrie (@alexhenrie) -
Fabian Maurer -
Fabian Maurer (@DarkShadow44)