summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2015-06-15 08:08:34 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2015-06-15 08:08:34 +0300
commit39ffbf1c921797f5885e782910fc0a14e903293a (patch)
treec5bf72699428b16b33a0d7b09eca4821bcb7d9c6
parentb67c791c8a2186d57fa643fb347e68e59c731770 (diff)
cnp: Add safety check for NULL pointer from malloc().
Summary: It could make crash when malloc is failed. @fix Reviewers: raster, woohyun, Hermet, JackDanielZ, thiepha Subscribers: JackDanielZ Differential Revision: https://phab.enlightenment.org/D2671
-rw-r--r--src/lib/elm_cnp.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index 5d32fee04..22e71e121 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -1024,18 +1024,21 @@ _x11_data_preparer_uri(Ecore_X_Event_Selection_Notify *notify,
1024 else 1024 else
1025 p = files->files[i]; 1025 p = files->files[i];
1026 1026
1027 len = strlen(p); 1027 if (s)
1028 strcpy(s, p);
1029 if (i < (files->num_files - 1))
1030 { 1028 {
1031 s[len] = '\n'; 1029 len = strlen(p);
1032 s[len + 1] = 0; 1030 strcpy(s, p);
1033 s += len + 1; 1031 if (i < (files->num_files - 1))
1034 } 1032 {
1035 else 1033 s[len] = '\n';
1036 { 1034 s[len + 1] = 0;
1037 s[len] = 0; 1035 s += len + 1;
1038 s += len; 1036 }
1037 else
1038 {
1039 s[len] = 0;
1040 s += len;
1041 }
1039 } 1042 }
1040 1043
1041 if (uri[i]) 1044 if (uri[i])