The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3450

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: Gaurav Singh <gaurav1...@gmail.com>

In the if condition : if !str is true i.e. str is NULL, it does further operations on str (fprintf) which can cause segmentation fault. Fix this by by changing the if condition to : 
if (str && strcmp(str, CONFIGFNAM))
From 3815ebccdb1e83cb2f3c8d5f94607fbffcc2f5c1 Mon Sep 17 00:00:00 2001
From: Gaurav Singh <gaurav1...@gmail.com>
Date: Sat, 13 Jun 2020 19:15:50 -0400
Subject: [PATCH] containertests: fix null pointer defereference

Signed-off-by: Gaurav Singh <gaurav1...@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;
        }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to