[gob] Wed Dec 23 14:02:11 2009 Jiri (George) Lebl <jirka 5z com>



commit f010341a4f78e51c09065838c19624235a7cb921
Author: Jiri (George) Lebl <jirka 5z com>
Date:   Wed Dec 23 14:02:54 2009 -0600

    Wed Dec 23 14:02:11 2009  Jiri (George) Lebl <jirka 5z com>
    
    	* src/util.c: fix remove_sep to avoid strcpy problems.  Patch from
    	  Ding-Yi Chen

 ChangeLog  |    5 +++++
 src/util.c |    8 ++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c4dc9f1..a4d81a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Dec 23 14:02:11 2009  Jiri (George) Lebl <jirka 5z com>
+
+	* src/util.c: fix remove_sep to avoid strcpy problems.  Patch from
+	  Ding-Yi Chen
+
 Tue Jul 21 10:20:58 2009  Jiri (George) Lebl <jirka 5z com>
 
 	* Release 2.0.16
diff --git a/src/util.c b/src/util.c
index 4d42440..86e44b8 100644
--- a/src/util.c
+++ b/src/util.c
@@ -81,13 +81,17 @@ remove_sep(const char *base)
 {
 	char *p;
 	char *s = g_strdup(base);
+	char *q=s;
 
 	/* don't eat C++ :: thingies */
 	if (for_cpp && strstr (s, "::") != NULL)
 		return s;
 
-	while((p = strchr(s, ':')))
-		strcpy(p, p+1);
+	for(p=(char *)base;*p;p++){
+		if (*p!=':')
+			*q++=*p;
+	}
+	*q='\0';
 	return s;
 }
 



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