[Libvir] [PATCH] Handle failed openvzLocateConfDir.
Jim Meyering
jim at meyering.net
Wed Feb 20 14:19:33 UTC 2008
Jim Meyering <jim at meyering.net> wrote:
> While looking at misuses of write, I found problems in src/openvz_conf.c
> Here's the first fix:
>
> Handle failed openvzLocateConfDir.
> * src/openvz_conf.c (openvzLocateConfDir, openvzGetVPSUUID):
> (openvzSetUUID): Don't dereference NULL upon failure.
>
> Signed-off-by: Jim Meyering <meyering at redhat.com>
> ---
> src/openvz_conf.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/src/openvz_conf.c b/src/openvz_conf.c
> index 482de82..fb38b43 100644
> --- a/src/openvz_conf.c
> +++ b/src/openvz_conf.c
> @@ -641,6 +641,8 @@ openvzGetVPSUUID(int vpsid, char *uuidstr)
> int fd, ret;
>
> conf_dir = openvzLocateConfDir();
> + if (conf_dir != NULL)
> + return -1
Whoa.
Chris Lalance pointed out another obvious flaw.
I meant to add *this*:
> + if (conf_dir == NULL)
> + return -1
Will repost shortly.
Thanks, Chris!
More information about the libvir-list
mailing list