[easytag] Revert "Refactor Scan_Convert_P20_Into_Space()"



commit ea53ac5940690e5c2d4823970e43049ab9508aae
Author: David King <amigadave amigadave com>
Date:   Tue Apr 22 19:36:37 2014 +0100

    Revert "Refactor Scan_Convert_P20_Into_Space()"
    
    This reverts commit 553ba87d0311e4e4c64f2321b5aa654df0c4ae29.
    
    The above commit added a call to strcpy(), with arguments that
    overlapped. The behaviour of such a call is undefined, and can lead to
    test failures.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728743

 src/scan.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/scan.c b/src/scan.c
index 1eab0d1..cc74e04 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -40,12 +40,15 @@ Scan_Convert_Underscore_Into_Space (gchar *string)
 void
 Scan_Convert_P20_Into_Space (gchar *string)
 {
-    gchar *tmp = string;
+    gchar *tmp, *tmp1;
 
-    while ((tmp = strstr (tmp, "%20")) != NULL)
+    while ((tmp = strstr (string, "%20")) != NULL)
     {
+        tmp1 = tmp + 3;
         *(tmp++) = ' ';
-        strcpy (tmp, tmp + 2);
+        while (*tmp1)
+            *(tmp++) = *(tmp1++);
+        *tmp = '\0';
     }
 }
 


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