summaryrefslogtreecommitdiff
path: root/app-text/namazu/files/namazu-2.0.21-memmove.patch
blob: 30ad490e44fa76aff94c3965e7b6d9e2a041ee95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
--- a/nmz/search.c
+++ b/nmz/search.c
@@ -572,7 +572,7 @@
 {
     if (*expr == '*' && expr[strlen(expr) - 1] != '*') {
         /* If suffix match such as '*bar', enforce it into regex */
-        strcpy(expr, expr + 1);
+        memmove(expr, expr + 1, strlen(expr));
         escape_meta_characters(expr, BUFSIZE * 2);
         strncat(expr, "$", BUFSIZE * 2 - strlen(expr) - 1);
         expr[BUFSIZE * 2 - 1] = '\0';
@@ -584,7 +584,7 @@
         expr[BUFSIZE * 2 - 1] = '\0';
     } else if (*expr == '*' && expr[strlen(expr) - 1] == '*') {
         /* If internal match such as '*foo*', enforce it into regex */
-        strcpy(expr, expr + 1);
+        memmove(expr, expr + 1, strlen(expr));
         expr[strlen(expr) - 1] = '\0';
         escape_meta_characters(expr, BUFSIZE * 2);
     } else if (*expr == '/' && expr[strlen(expr) - 1] == '/') {
@@ -592,7 +592,7 @@
             nmz_debug_printf("do REGEX search\n");
             /* Genuine regex */
             /* Remove the both of '/' chars at begging and end of string */
-            strcpy(expr, expr + 1);
+            memmove(expr, expr + 1, strlen(expr));
             expr[strlen(expr) - 1]= '\0';
         } else {
             nmz_debug_printf("disabled REGEX search\n");
@@ -605,7 +605,7 @@
             || (*expr == '{' && expr[strlen(expr) - 1] == '}')) 
         {
             /* Delimiters of field search */
-            strcpy(expr, expr + 1); 
+            memmove(expr, expr + 1, strlen(expr)); 
             expr[strlen(expr) - 1] = '\0';
         }
         escape_meta_characters(expr, BUFSIZE * 2);
@@ -695,7 +695,7 @@
 delete_beginning_backslash(char *str)
 {
     if (*str == '\\') {
-        strcpy(str, str + 1);
+        memmove(str, str + 1, strlen(str));
     }
 }
 
@@ -935,7 +935,7 @@
     if ((strlen(str) >= 3 && (*str == '"' && str[strlen(str) - 1] == '"'))
         || (*str == '{' && str[strlen(str) - 1] == '}')) 
     {
-        strcpy(str, str + 1); 
+        memmove(str , str + 1, strlen(str)); 
         str[strlen(str) - 1]= '\0';
     } 
 }