Enlightenment CVS committal
Author : rbdpngn
Project : e17
Module : libs/ewl
Dir : e17/libs/ewl/src
Modified Files:
ewl_entry.c
Log Message:
Some sanity checks to catch possible segvs in the entry, submitted by Vincent
Torri.
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_entry.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -3 -r1.85 -r1.86
--- ewl_entry.c 13 May 2004 06:03:00 -0000 1.85
+++ ewl_entry.c 21 May 2004 18:44:27 -0000 1.86
@@ -547,32 +547,38 @@
DENTER_FUNCTION(DLEVEL_STABLE);
DCHECK_PARAM_PTR("e", e);
+ DCHECK_PARAM_PTR("s", s);
s2 = ewl_entry_get_text(e);
l = strlen(s);
- l2 = strlen(s2);
+
+ if (s2)
+ l2 = strlen(s2);
+ else
+ l2 = 0;
sp = ewl_cursor_get_start_position(EWL_CURSOR(e->cursor));
s3 = NEW(char, l + 1 + l2);
if (!s3) {
- FREE(s2);
+ IF_FREE(s2);
DRETURN(DLEVEL_STABLE);
}
s3[0] = 0;
- strncat(s3, s2, sp - 1);
+ if (s2)
+ strncat(s3, s2, sp - 1);
strcat(s3, s);
ep = ewl_cursor_get_end_position(EWL_CURSOR(e->cursor));
if (!ep || (sp != ep))
ep++;
- strcat(s3, &(s2[ep - 1]));
+ if (s2) strcat(s3, &(s2[ep - 1]));
ewl_entry_set_text(e, s3);
ewl_cursor_set_base(EWL_CURSOR(e->cursor), ep);
- FREE(s2);
+ IF_FREE(s2);
FREE(s3);
sp++;
@@ -594,6 +600,9 @@
ep = ewl_cursor_get_end_position(EWL_CURSOR(e->cursor));
s = ewl_entry_get_text(e);
+ if (!s)
+ DRETURN(DLEVEL_STABLE);
+
if (!strlen(s) || (sp == ep && sp < 2)) {
FREE(s);
DRETURN(DLEVEL_STABLE);
@@ -628,6 +637,8 @@
ep = ewl_cursor_get_end_position(EWL_CURSOR(e->cursor));
s = ewl_entry_get_text(e);
+ if (!s)
+ DRETURN(DLEVEL_STABLE);
if (!strlen(s) || ep == strlen(s) + 1)
DRETURN(DLEVEL_STABLE);
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs