summaryrefslogtreecommitdiff
path: root/src/edje_externals
diff options
context:
space:
mode:
authorMinwoo, Lee <minwoo47.lee@samsung.net>2015-06-17 14:25:29 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-06-17 15:59:19 +0200
commit3da3082d18d29b13e4c80fe30218a6a9c55e9e7e (patch)
tree54f3d11bdd4ab89a4b9bd68f381099b65a1c8943 /src/edje_externals
parent2bc0aef96460c7763685dc7426e63e7398214056 (diff)
edje_externals: add safety check for NULL pointer
Summary: Dereferencing null pointers in external_signal() Reviewers: bdilly, raster, woohyun, cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2688 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/edje_externals')
-rw-r--r--src/edje_externals/elm.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/edje_externals/elm.c b/src/edje_externals/elm.c
index 54bbb3baf..8ce77ac5a 100644
--- a/src/edje_externals/elm.c
+++ b/src/edje_externals/elm.c
@@ -47,6 +47,9 @@ external_signal(void *data EINA_UNUSED, Evas_Object *obj, const char *sig,
47 char *_signal = strdup(sig); 47 char *_signal = strdup(sig);
48 char *p = _signal; 48 char *p = _signal;
49 Evas_Object *content; 49 Evas_Object *content;
50 Edje_External_Type *type;
51
52 if (!p) goto on_error;
50 53
51 while ((*p!='\0') && (*p!=']')) 54 while ((*p!='\0') && (*p!=']'))
52 p++; 55 p++;
@@ -55,26 +58,33 @@ external_signal(void *data EINA_UNUSED, Evas_Object *obj, const char *sig,
55 if ((*p=='\0') || (*(p+1)!=':')) 58 if ((*p=='\0') || (*(p+1)!=':'))
56 { 59 {
57 ERR("Invalid External Signal received: '%s' '%s'", sig, source); 60 ERR("Invalid External Signal received: '%s' '%s'", sig, source);
58 free(_signal); 61 goto on_error;
59 return ;
60 } 62 }
61 63
62 *p = '\0'; 64 *p = '\0';
63 p+=2; //jump ']' and ':' 65 p+=2; //jump ']' and ':'
64 66
65 Edje_External_Type *type = evas_object_data_get(obj, "Edje_External_Type"); 67 type = evas_object_data_get(obj, "Edje_External_Type");
68 if (!type)
69 {
70 ERR("no external type for object %p", obj);
71 goto on_error;
72 }
66 if (!type->content_get) 73 if (!type->content_get)
67 { 74 {
68 ERR("external type '%s' from module '%s' does not provide content_get()", 75 ERR("external type '%s' from module '%s' does not provide content_get()",
69 type->module_name, type->module); 76 type->module_name, type->module);
70 free(_signal); 77 goto on_error;
71 return ;
72 } 78 }
73 79
74 content = type->content_get(type->data, obj, _signal); 80 content = type->content_get(type->data, obj, _signal);
75 free(_signal); 81 free(_signal);
76 if (content) 82 if (content)
77 edje_object_signal_emit(content, sig + (p - _signal), source); 83 edje_object_signal_emit(content, sig + (p - _signal), source);
84
85on_error:
86 if (_signal) free(_signal);
87 return;
78} 88}
79 89
80const char * 90const char *