jackdanielz pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=01be46a784115daa6235170ef9d33d4a6b8da0b1

commit 01be46a784115daa6235170ef9d33d4a6b8da0b1
Author: Youngbok Shin <youngb.s...@samsung.com>
Date:   Fri Jun 12 11:02:05 2015 +0300

    cnp: Add safety check for NULL pointer from strdup().
    
    Summary:
    It could make crash when strdup() is failed.
    CID - 329115
    @fix
    
    Reviewers: raster, thiepha, woohyun, Hermet
    
    Differential Revision: https://phab.enlightenment.org/D2673
---
 src/lib/elm_cnp.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index 12f71fb..31f7d14 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -1316,6 +1316,14 @@ _x11_text_converter(char *target, void *data, int size, 
void **data_ret, int *si
                                    (const char **)data_ret, NULL);
         if (!*data_ret) *data_ret = strdup("No file");
         else *data_ret = strdup(*data_ret);
+
+        if (!*data_ret)
+          {
+             ERR("Failed to allocate memory!");
+             *size_ret = 0;
+             return EINA_FALSE;
+          }
+
         *size_ret = strlen(*data_ret);
      }
    return EINA_TRUE;

-- 


Reply via email to