From a16d90b5e22aba2b6dc5cd00f08d6ff3f386ed5b 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 b873c6fc3..c4330895b 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -516,6 +516,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