[libvirt] [PATCH 4/7] virGetHostnameLocalhost: avoid FP NULL-ptr-deref from clang
Daniel P. Berrange
berrange at redhat.com
Wed Apr 14 17:40:28 UTC 2010
On Wed, Apr 14, 2010 at 06:02:33PM +0200, Jim Meyering wrote:
> From: Jim Meyering <meyering at redhat.com>
>
> * src/util/util.c (virGetHostnameLocalhost): Add an sa_assert
> to tell clang it's ok to dereference "info" after a non-failing
> getaddrinfo call.
> ---
> src/util/util.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/src/util/util.c b/src/util/util.c
> index 405c5f3..268944d 100644
> --- a/src/util/util.c
> +++ b/src/util/util.c
> @@ -2394,6 +2394,9 @@ char *virGetHostnameLocalhost(int allow_localhost)
> return NULL;
> }
>
> + /* Tell static analyzers about getaddrinfo semantics. */
> + sa_assert (info);
> +
> /* if we aren't allowing localhost, then we iterate through the
> * list and make sure none of the IPv4 addresses are 127.0.0.1 and
> * that none of the IPv6 addresses are ::1
ACK
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list