cnp: Add safety check for NULL pointer from _elm_util_text_to_mkup().
authorYoungbok Shin <youngb.shin@samsung.com>
Fri, 12 Jun 2015 07:56:22 +0000 (10:56 +0300)
committerDaniel Zaoui <daniel.zaoui@yahoo.com>
Fri, 12 Jun 2015 07:56:22 +0000 (10:56 +0300)
Summary:
_elm_util_text_to_mkup() func could return NULL when malloc is failed internally.
CID - 398441
@fix

Reviewers: raster, thiepha, woohyun, Hermet

Differential Revision: https://phab.enlightenment.org/D2668

src/lib/elm_cnp.c

index 2916a6f..d2bd5e0 100644 (file)
@@ -996,6 +996,14 @@ _x11_notify_handler_text(X11_Cnp_Selection *sel, Ecore_X_Event_Selection_Notify
         cnp_debug("Notify handler text %d %d %p\n", data->format,
                   data->length, data->data);
         mkupstr = _elm_util_text_to_mkup((const char *)stripstr);
+
+        if (!mkupstr)
+          {
+             ERR("Failed to convert text to markup text!");
+             free(stripstr);
+             goto end;
+          }
+
         cnp_debug("String is %s (from %s)\n", stripstr, data->data);
         /* TODO BUG: should never NEVER assume it's an elm_entry! */
         _elm_entry_entry_paste(sel->requestwidget, mkupstr);