Segmentation fault in editor (F4+F4)



 Nobody noticed it?

I did two alternative patches. Any of them avoids
the problem for me. Whoever did the changes may
chose. I think we could keep both.

We're trying to put a zero in a real empty string
which was defined as

char *exp1="";
char *exp2="";
char *exp3="";

and this causes the error.

*8-) David


_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
diff -uPr mc-2002-11-08-18/src/charsets.c mc.new/src/charsets.c
--- mc-2002-11-08-18/src/charsets.c	Thu Oct 31 16:54:27 2002
+++ mc.new/src/charsets.c	Sat Nov  9 18:30:04 2002
@@ -227,11 +227,11 @@
 void
 convert_to_display (char *str)
 {
-    if (!str)
-	return;
-
-    while ((*str = conv_displ[(unsigned char) *str]))
-	str++;
+    if (str)
+        while (*str) {
+	    *str = conv_displ[(unsigned char) *str];
+	    str++;
+	}
 }
 
 void

diff -uPr mc-2002-11-08-18/edit/editcmd.c mc.new/edit/editcmd.c
--- mc-2002-11-08-18/edit/editcmd.c	Wed Nov  6 20:47:34 2002
+++ mc.new/edit/editcmd.c	Sat Nov  9 18:36:31 2002
@@ -1578,9 +1578,9 @@
     static char *old1 = NULL;
     static char *old2 = NULL;
     static char *old3 = NULL;
-    char *exp1 = "";
-    char *exp2 = "";
-    char *exp3 = "";
+    char *exp1;
+    char *exp2;
+    char *exp3;
     int replace_yes;
     int replace_continue;
     int treplace_prompt = 0;
@@ -1607,9 +1607,9 @@
 
     edit->force |= REDRAW_COMPLETELY;
 
-    exp1 = old1 ? old1 : exp1;
-    exp2 = old2 ? old2 : exp2;
-    exp3 = old3 ? old3 : exp3;
+    exp1 = old1 ? old1 : g_strdup("");
+    exp2 = old2 ? old2 : g_strdup("");
+    exp3 = old3 ? old3 : g_strdup("");
 
     if (again) {
 	if (!old1 || !old2)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]