[lxc-devel] [lxc/master] containertests: fix null pointer defereference

gaurav1086 on Github lxc-bot at linuxcontainers.org
Sat Jun 13 23:19:17 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 574 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200613/96ccc6ac/attachment.bin>
-------------- next part --------------
From 3815ebccdb1e83cb2f3c8d5f94607fbffcc2f5c1 Mon Sep 17 00:00:00 2001
From: Gaurav Singh <gaurav1086 at gmail.com>
Date: Sat, 13 Jun 2020 19:15:50 -0400
Subject: [PATCH] containertests: fix null pointer defereference

Signed-off-by: Gaurav Singh <gaurav1086 at gmail.com>
---
 src/tests/containertests.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tests/containertests.c b/src/tests/containertests.c
index b28bcd56d6..0fb6fbdfbf 100644
--- a/src/tests/containertests.c
+++ b/src/tests/containertests.c
@@ -135,7 +135,7 @@ int main(int argc, char *argv[])
 
 	str = c->config_file_name(c);
 #define CONFIGFNAM LXCPATH "/" MYNAME "/config"
-	if (!str || strcmp(str, CONFIGFNAM)) {
+	if (str && strcmp(str, CONFIGFNAM)) {
 		fprintf(stderr, "%d: got wrong config file name (%s, not %s)\n", __LINE__, str, CONFIGFNAM);
 		goto out;
 	}


More information about the lxc-devel mailing list