summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2015-06-12 11:02:05 +0300
committerDaniel Zaoui <daniel.zaoui@yahoo.com>2015-06-12 11:02:05 +0300
commit01be46a784115daa6235170ef9d33d4a6b8da0b1 (patch)
tree6b1ad372325582fd52ecb267484216e38ab8e4c4
parentcd8e6dbce15203d8efbec6767997169de4efe1e6 (diff)
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
-rw-r--r--src/lib/elm_cnp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index 12f71fb3f..31f7d1421 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
1316 (const char **)data_ret, NULL); 1316 (const char **)data_ret, NULL);
1317 if (!*data_ret) *data_ret = strdup("No file"); 1317 if (!*data_ret) *data_ret = strdup("No file");
1318 else *data_ret = strdup(*data_ret); 1318 else *data_ret = strdup(*data_ret);
1319
1320 if (!*data_ret)
1321 {
1322 ERR("Failed to allocate memory!");
1323 *size_ret = 0;
1324 return EINA_FALSE;
1325 }
1326
1319 *size_ret = strlen(*data_ret); 1327 *size_ret = strlen(*data_ret);
1320 } 1328 }
1321 return EINA_TRUE; 1329 return EINA_TRUE;