[libvirt PATCH 5/8] esx: esxConnectOpen: use allocated buffer

Pino Toscano ptoscano at redhat.com
Mon Oct 5 11:33:19 UTC 2020


On Monday, 5 October 2020 00:21:42 CEST Ján Tomko wrote:
> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> ---
>  src/esx/esx_driver.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
> index e82e5ed835..0798493296 100644
> --- a/src/esx/esx_driver.c
> +++ b/src/esx/esx_driver.c
> @@ -813,7 +813,7 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
>      virDrvOpenStatus result = VIR_DRV_OPEN_ERROR;
>      esxPrivate *priv = NULL;
>      char *potentialVCenterIPAddress = NULL;
> -    char vCenterIPAddress[NI_MAXHOST] = "";
> +    g_autofree char *vCenterIPAddress = g_new0(char, NI_MAXHOST);

Hmm, this is not the only char[NI_MAXHOST] in this file, so I'm
surprised only this one triggered the stack limit check.

The NI_MAXHOST-limited buffer seems to be due to
esxUtil_ResolveHostname(), which forces it due to its interface.
I'll rewrite it to return a new string instead; consider it as a NACK
for this patch.

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201005/cd988992/attachment-0001.sig>


More information about the libvir-list mailing list