From 76da5302d7fbb108075e0d7d25b772cd062e73f4 Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Thu, 12 Jan 2017 14:36:15 -0700
Subject: [PATCH] Fix for possible out of bounds memory reference reported by
 Coverity

---
 src/api/step_launch.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/api/step_launch.c b/src/api/step_launch.c
index e4644ce803e..a5c6f9f7673 100644
--- a/src/api/step_launch.c
+++ b/src/api/step_launch.c
@@ -968,7 +968,11 @@ static int _connect_srun_cr(char *addr)
 	unsigned int sa_len;
 	int fd, rc;
 
-	if (addr && (strlen(addr) > sizeof(sa.sun_path))) {
+	if (!addr) {
+		error("%s: socket path name is NULL", __func__);
+		return -1;
+	}
+	if (strlen(addr) >= sizeof(sa.sun_path)) {
 		error("%s: socket path name too long (%s)", __func__, addr);
 		return -1;
 	}
-- 
GitLab