[PATCH 0/1] MR4799: wmiutils: Always zero path->namespaces in parse_text(Coverity)
When the malloc for len_namespaces should fail namespaces would be uninitialized and passed to free. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4799
From: Fabian Maurer <dark.shadow4(a)web.de> When the malloc for len_namespaces should fail namespaces would be uninitialized and passed to free. --- dlls/wmiutils/path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wmiutils/path.c b/dlls/wmiutils/path.c index 0f0263c9536..48b79ccdb23 100644 --- a/dlls/wmiutils/path.c +++ b/dlls/wmiutils/path.c @@ -437,7 +437,7 @@ static HRESULT parse_text( struct path *path, ULONG mode, const WCHAR *text ) } if (path->num_namespaces) { - if (!(path->namespaces = malloc( path->num_namespaces * sizeof(WCHAR *) ))) goto done; + if (!(path->namespaces = calloc( path->num_namespaces, sizeof(WCHAR *) ))) goto done; if (!(path->len_namespaces = malloc( path->num_namespaces * sizeof(int) ))) goto done; i = 0; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4799
This merge request was approved by Hans Leidekker. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4799
participants (3)
-
Fabian Maurer -
Fabian Maurer (@DarkShadow44) -
Hans Leidekker (@hans)