[libvirt] [PATCH] nwfilter: Fix random index in virNWFilterRuleDefDetailsFormat

An uninitialized int value was used to index an array. This can result in a segfault in nwfilterxml2xmltest. --- src/conf/nwfilter_conf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index 08934fb..7c71ece 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -2375,7 +2375,7 @@ virNWFilterRuleDefDetailsFormat(virConnectPtr conn, const virXMLAttr2Struct *att, virNWFilterRuleDefPtr def) { - int i, j; + int i = 0, j; bool typeShown = 0; bool neverShown = 1; enum match { -- 1.6.3.3

libvir-list-bounces@redhat.com wrote on 04/03/2010 06:55:56 PM:
[image removed]
An uninitialized int value was used to index an array. This can result in a segfault in nwfilterxml2xmltest. --- src/conf/nwfilter_conf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index 08934fb..7c71ece 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -2375,7 +2375,7 @@ virNWFilterRuleDefDetailsFormat(virConnectPtr conn, const virXMLAttr2Struct *att, virNWFilterRuleDefPtr def) { - int i, j; + int i = 0, j; bool typeShown = 0; bool neverShown = 1; enum match {
ACK. Please push. Is it my version of gcc or libvirt compiler flags that fail to tell me about a 'possibly uninitialized variable'? Regards, Stefan
-- 1.6.3.3
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

2010/4/4 Stefan Berger <stefanb@us.ibm.com>:
libvir-list-bounces@redhat.com wrote on 04/03/2010 06:55:56 PM:
[image removed]
An uninitialized int value was used to index an array. This can result in a segfault in nwfilterxml2xmltest. --- src/conf/nwfilter_conf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index 08934fb..7c71ece 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -2375,7 +2375,7 @@ virNWFilterRuleDefDetailsFormat(virConnectPtr conn, const virXMLAttr2Struct *att, virNWFilterRuleDefPtr def) { - int i, j; + int i = 0, j; bool typeShown = 0; bool neverShown = 1; enum match {
ACK. Please push.
Is it my version of gcc or libvirt compiler flags that fail to tell me about a 'possibly uninitialized variable'?
Regards, Stefan
I didn't get a compiler warning about this either. I found it because of the segfault in the test case. Thanks. pushed. Matthias
participants (2)
-
Matthias Bolte
-
Stefan Berger