On Tue, May 3, 2016 at 4:29 AM Thiep Ha <[email protected]> wrote: > thiep pushed a commit to branch master. > > > http://git.enlightenment.org/core/efl.git/commit/?id=bcba96656afc534a8ad70da772a95aba592878fc > > commit bcba96656afc534a8ad70da772a95aba592878fc > Author: Thiep Ha <[email protected]> > Date: Tue May 3 10:41:00 2016 +0000 > > elm cnp/wl: add uri data type checking > > When selection owner provides uri type (uri/text-list), > it should check if data is in correct format. > --- > src/lib/elementary/elm_cnp.c | 28 +++++++++++++++++++++------- > 1 file changed, 21 insertions(+), 7 deletions(-) > > diff --git a/src/lib/elementary/elm_cnp.c b/src/lib/elementary/elm_cnp.c > index ab0951e..9808f45 100644 > --- a/src/lib/elementary/elm_cnp.c > +++ b/src/lib/elementary/elm_cnp.c > @@ -2495,16 +2495,26 @@ _wl_targets_converter(char *target, > Wl_Cnp_Selection *sel EINA_UNUSED, void *dat > int len = 0; > int i = 0; > Elm_Sel_Format formats = ELM_SEL_FORMAT_NONE; > - Cnp_Atom *atom = NULL; > + Eina_Bool is_uri = EINA_FALSE; > > - atom = eina_hash_find(_types_hash, target); > - if (atom) > - formats = atom->formats; > + if (sel->format) > + { > + formats = sel->format; > + is_uri = _wl_is_uri_type_data(sel->selbuf, sel->buflen); > + } > + else > + { > + Cnp_Atom *atom = eina_hash_find(_types_hash, target); > + if (atom) > + formats = atom->formats; > + } > for (i = 0; i < CNP_N_ATOMS; i++) > { > if (formats & _atoms[i].formats) > { > - len += strlen(_atoms[i].name) + strlen(sep); > + if ((is_uri) || ((!is_uri) && > + strcmp(_atoms[i].name, "text/uri-list"))) > + len += strlen(_atoms[i].name) + strlen(sep); > } > } > aret = calloc(1, len * sizeof(char)); > @@ -2513,8 +2523,12 @@ _wl_targets_converter(char *target, > Wl_Cnp_Selection *sel EINA_UNUSED, void *dat > { > if (formats & _atoms[i].formats) > { > - aret = strcat(aret, _atoms[i].name); > - aret = strcat(aret, sep); > + if ((is_uri) || ((!is_uri) && > + strcmp(_atoms[i].name, "text/uri-list"))) > + { > + aret = strcat(aret, _atoms[i].name); > + aret = strcat(aret, sep); > + } >
This function should probably only iterate once and use a strbuf in order to avoid future length calculation issues and overoptimizations. > } > } > *data_ret = aret; > > -- > > > ------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
