While looking at used of LCRSODIR, I saw an unchecked strdup.
That could lead to a NULL dereference.
Here's a fix:

>From bd2ce7fcba899c5777a8f490fcf288cdcba88781 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Thu, 19 Mar 2009 14:44:23 +0100
Subject: [PATCH] don't store (and later deref) NULL on failed strdup

* lcr_ifact.c (defaults_path_build): Don't store NULL when
strdup fails.
---
 lcr/lcr_ifact.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/lcr/lcr_ifact.c b/lcr/lcr_ifact.c
index b5ed62f..b1ea5dc 100644
--- a/lcr/lcr_ifact.c
+++ b/lcr/lcr_ifact.c
@@ -176,8 +176,7 @@ static void defaults_path_build (void)
        char *res;

        res = getcwd (cwd, sizeof (cwd));
-       if (res != NULL) {
-               path_list[0] = strdup (cwd);
+       if (res != NULL && (path_list[0] = strdup (cwd)) != NULL) {
                path_list_entries++;
        }
        
--
1.6.2.rc1.285.gc5f54
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to