[PATCH 01/14] tests: utils: Tolerate NULL actual data in virTestCompareToFile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The function docs state that 'strcontent' may be NULL, but code added in
3506f1ecfde did not use the 'cmpcontent' variable which was fixed and
dereferenced it.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/testutils.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/testutils.c b/tests/testutils.c
index 040ef1d2f7..4bd1b63755 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -800,8 +800,8 @@ virTestCompareToFile(const char *strcontent,

         if (filecontentLen > 0 &&
             filecontent[filecontentLen - 1] == '\n' &&
-            strcontent[strlen(strcontent) - 1] != '\n') {
-            if (virAsprintf(&fixedcontent, "%s\n", strcontent) < 0)
+            cmpcontent[strlen(cmpcontent) - 1] != '\n') {
+            if (virAsprintf(&fixedcontent, "%s\n", cmpcontent) < 0)
                 goto failure;
             cmpcontent = fixedcontent;
         }
-- 
2.16.2

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux