[libvirt PATCH 0/2] fixes allocation issues leading to crashes

Pavel Hrdina posted 2 patches 3 years, 6 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1602526188.git.phrdina@redhat.com
src/conf/virinterfaceobj.c  | 2 +-
src/conf/virnetworkobj.c    | 4 ++--
src/conf/virnodedeviceobj.c | 2 +-
src/conf/virsecretobj.c     | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
[libvirt PATCH 0/2] fixes allocation issues leading to crashes
Posted by Pavel Hrdina 3 years, 6 months ago
Our libvirt-dbus tests discovered allocation issues introduced by recent
rewrite to use g_new0 instead of VIR_ALLOC_N by allocating array one
element shorter in some places which can lead to crashes of client
applications counting on a fact that the returned arrays are NULL
terminated.

Pavel Hrdina (2):
  conf: fix g_new0 allocation
  conf: virsecretobj: fix g_new0 allocation

 src/conf/virinterfaceobj.c  | 2 +-
 src/conf/virnetworkobj.c    | 4 ++--
 src/conf/virnodedeviceobj.c | 2 +-
 src/conf/virsecretobj.c     | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

-- 
2.26.2

Re: [libvirt PATCH 0/2] fixes allocation issues leading to crashes
Posted by Ján Tomko 3 years, 6 months ago
On a Monday in 2020, Pavel Hrdina wrote:
>Our libvirt-dbus tests discovered allocation issues introduced by recent
>rewrite to use g_new0 instead of VIR_ALLOC_N by allocating array one
>element shorter in some places which can lead to crashes of client
>applications counting on a fact that the returned arrays are NULL
>terminated.
>

Oops, I did not notice that my vim macro [0] dropped these (due to looking
for the ')' from the left side).
There seem to be no other cases like this in my changes where the
expression contains a parenthesis.

Thanks for fixing this.

Jano

>Pavel Hrdina (2):
>  conf: fix g_new0 allocation
>  conf: virsecretobj: fix g_new0 allocation
>
> src/conf/virinterfaceobj.c  | 2 +-
> src/conf/virnetworkobj.c    | 4 ++--
> src/conf/virnodedeviceobj.c | 2 +-
> src/conf/virsecretobj.c     | 2 +-
> 4 files changed, 5 insertions(+), 5 deletions(-)
>

[0] I was not able to replace everything with Coccinelle