It missed simple null checking after malloc.

+ char *stripstr = malloc(sizeof(char) * (data->length + 1));+ 
strncpy(stripstr, (char *)data->data, data->length);


------------------------------------

-Regards, Hermet-


-----Original Message-----
From: "Enlightenment SVN"<no-re...@enlightenment.org> 
To: <enlightenment-...@lists.sourceforge.net>; 
Cc: 
Sent: 2012-05-22 (화) 10:35:13
Subject: E SVN: hyoyoung trunk/elementary/src/lib

Log:
elementary/cnp: add null terminating at handling html type
  
  Signed-off-by: Michal Pakula vel Rutka <m.pakula>@samsung.com>
  

Author:       hyoyoung
Date:         2012-05-21 18:35:12 -0700 (Mon, 21 May 2012)
New Revision: 71291
Trac:         http://trac.enlightenment.org/e/changeset/71291

Modified:
  trunk/elementary/src/lib/elm_cnp.c 

Modified: trunk/elementary/src/lib/elm_cnp.c
===================================================================
--- trunk/elementary/src/lib/elm_cnp.c  2012-05-21 16:55:29 UTC (rev 71290)
+++ trunk/elementary/src/lib/elm_cnp.c  2012-05-22 01:35:12 UTC (rev 71291)
@@ -978,21 +978,21 @@
 
    cnp_debug("Got some HTML: Checking encoding is useful\n");
    data = notify->data;
+   char *stripstr = malloc(sizeof(char) * (data->length + 1));
+   strncpy(stripstr, (char *)data->data, data->length);
+   stripstr[data->length] = '\0';
 
    if (sel->datacb)
      {
         Elm_Selection_Data ddata;
         ddata.x = ddata.y = 0;
         ddata.format = ELM_SEL_FORMAT_HTML;
-        ddata.data = data->data;
+        ddata.data = stripstr;
         ddata.len = data->length;
         sel->datacb(sel->udata, sel->widget, &ddata);
         return 0;
      }
 
-   char *stripstr = malloc(sizeof(char) * (data->length + 1));
-   strncpy(stripstr, (char *)data->data, data->length);
-   stripstr[data->length] = '\0';
    cnp_debug("String is %s (%d bytes)\n", stripstr, data->length);
    _elm_entry_entry_paste(sel->requestwidget, stripstr);
    free(stripstr);


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-svn mailing list
enlightenment-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-svn



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to