Should not change the logic, but makes Coverity happy and seems safer
Signed-off-by: Fabian Maurer dark.shadow4@web.de
From: Fabian Maurer dark.shadow4@web.de
Should not change the logic, but makes Coverity happy and seems safer
Signed-off-by: Fabian Maurer dark.shadow4@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));
I think it would be better to just mark this as a false positive in Coverity.
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...
So, should that be closed? Or does it have merit?
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.
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!
This merge request was closed by Fabian Maurer.