Enlightenment CVS committal

Author  : rbdpngn
Project : e17
Module  : libs/etox

Dir     : e17/libs/etox/src


Modified Files:
        etox.c etox_line.c etox_line.h 


Log Message:
Some safeguards to track down strings triggering a buffer overflow.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -3 -r1.99 -r1.100
--- etox.c      26 Oct 2004 14:00:22 -0000      1.99
+++ etox.c      30 Oct 2004 04:42:23 -0000      1.100
@@ -693,7 +693,7 @@
         */
        for (l = et->lines; l; l = l->next) {
                line = l->data;
-               etox_line_get_text(line, temp);
+               etox_line_get_text(line, temp, et->length);
 
                /*
                 * FIXME: Currently, in etox_line_get_text(), line->length
@@ -1093,7 +1093,7 @@
        }
 
        if (!et->lines)
-               return;
+               return sum;
 
        if (!line)
                line = et->lines->last->data;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_line.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -3 -r1.44 -r1.45
--- etox_line.c 7 Oct 2004 17:48:03 -0000       1.44
+++ etox_line.c 30 Oct 2004 04:42:23 -0000      1.45
@@ -356,7 +356,7 @@
  * Returns no value. Saves the text from the line @line into the char buffer
  * @buf.
  */
-void etox_line_get_text(Etox_Line * line, char *buf)
+void etox_line_get_text(Etox_Line * line, char *buf, int len)
 {
        char *temp;
        Evas_Object *es;
@@ -384,7 +384,8 @@
                        temp = "\t";
                else
                        temp = etox_style_get_text(es);
-               strcat(buf, temp);
+               if (snprintf(buf, len, "%s%s", buf, temp) < len)
+                       fprintf(stderr, "WARNING! Etox concatenated a line.");
                free(temp);
        }
        line->length = sum;
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/etox/src/etox_line.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- etox_line.h 18 Oct 2003 16:43:37 -0000      1.14
+++ etox_line.h 30 Oct 2004 04:42:23 -0000      1.15
@@ -12,7 +12,7 @@
 void etox_line_merge_append(Etox_Line * line1, Etox_Line * line2);
 void etox_line_merge_prepend(Etox_Line * line1, Etox_Line * line2);
 void etox_line_minimize(Etox_Line * line);
-void etox_line_get_text(Etox_Line * line, char *buf);
+void etox_line_get_text(Etox_Line * line, char *buf, int len);
 
 int etox_line_wrap(Etox *et, Etox_Line *line);
 void etox_line_split(Etox_Line *line, Evas_Object *bit, int index);




-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to