From 18d4ffded4e520e6df43cc81b5eef5388d03dc68 Mon Sep 17 00:00:00 2001 From: 2xsec Date: Sat, 21 Jul 2018 22:47:08 +0900 Subject: [PATCH] coverity: #1438067 Explicit null dereferenced Signed-off-by: 2xsec --- src/lxc/attach.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lxc/attach.c b/src/lxc/attach.c index 5fe25429e..6fa53ebb4 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -534,6 +534,9 @@ static char *lxc_attach_getpwshell(uid_t uid) if (found) continue; + if (!line) + continue; + /* Trim line on the right hand side. */ for (i = strlen(line); i > 0 && (line[i - 1] == '\n' || line[i - 1] == '\r'); --i) line[i - 1] = '\0'; -- 2.47.2