Re: [libvirt] [PATCH] leaseshelper: fix crash when no mac is specified

2016-01-19 Thread Daniel P. Berrange
On Thu, Jan 14, 2016 at 03:15:04PM +0100, Ján Tomko wrote:
> If dnsmasq specified DNSMASQ_IAID (so we're dealing with an IPv6
> lease) but no DNSMASQ_MAC, we skip creation of the new lease object.
> 
> Also skip adding it to the leases array.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1202350
> https://bugzilla.redhat.com/show_bug.cgi?id=1292941
> ---
>  src/network/leaseshelper.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
> index 2d528f7..6930310 100644
> --- a/src/network/leaseshelper.c
> +++ b/src/network/leaseshelper.c
> @@ -439,7 +439,7 @@ main(int argc, char **argv)
>  
>  case VIR_LEASE_ACTION_OLD:
>  case VIR_LEASE_ACTION_ADD:
> -if (virJSONValueArrayAppend(leases_array_new, lease_new) < 0) {
> +if (lease_new && virJSONValueArrayAppend(leases_array_new, 
> lease_new) < 0) {
>  virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> _("failed to create json"));
>  goto cleanup;

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] leaseshelper: fix crash when no mac is specified

2016-01-14 Thread Ján Tomko
If dnsmasq specified DNSMASQ_IAID (so we're dealing with an IPv6
lease) but no DNSMASQ_MAC, we skip creation of the new lease object.

Also skip adding it to the leases array.

https://bugzilla.redhat.com/show_bug.cgi?id=1202350
https://bugzilla.redhat.com/show_bug.cgi?id=1292941
---
 src/network/leaseshelper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index 2d528f7..6930310 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -439,7 +439,7 @@ main(int argc, char **argv)
 
 case VIR_LEASE_ACTION_OLD:
 case VIR_LEASE_ACTION_ADD:
-if (virJSONValueArrayAppend(leases_array_new, lease_new) < 0) {
+if (lease_new && virJSONValueArrayAppend(leases_array_new, lease_new) 
< 0) {
 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to create json"));
 goto cleanup;
-- 
2.4.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] leaseshelper: fix crash

2014-06-11 Thread Pavel Hrdina
Commit baafe668 introduced new leaseshelper with a crash of freeing
env string. Calling 'getenv()' inside 'virGetEnvAllowSUID()' may
return a static string and we definitely should not free it.

The author probably want to free the copy of that string.

Signed-off-by: Pavel Hrdina 
---

pushed under trivial rule

 src/network/leaseshelper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index b6f6c32..69081c3 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -351,7 +351,7 @@ main(int argc, char **argv)
 virPidFileReleasePath(pid_file, pid_file_fd);
 
 VIR_FREE(pid_file);
-VIR_FREE(exptime_tmp);
+VIR_FREE(exptime);
 VIR_FREE(custom_lease_file);
 virJSONValueFree(lease_new);
 virJSONValueFree(leases_array);
-- 
1.8.5.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list