Unidiff1 files changed, 8 insertions, 3 deletions
|
diff --git a/cache.c b/cache.c index 7cdea9b..372e38d 100644 --- a/ cache.c+++ b/ cache.c |
|
@@ -12,10 +12,15 @@ const int NOLOCK = -1; |
12 | |
12 | |
13 | char *cache_safe_filename(const char *unsafe) |
13 | char *cache_safe_filename(const char *unsafe) |
14 | { |
14 | { |
15 | static char buf[PATH_MAX]; |
15 | static char buf[4][PATH_MAX]; |
16 | char *s = buf; |
16 | static int bufidx; |
| |
17 | char *s; |
17 | char c; |
18 | char c; |
18 | |
19 | |
| |
20 | bufidx++; |
| |
21 | bufidx &= 3; |
| |
22 | s = buf[bufidx]; |
| |
23 | |
19 | while(unsafe && (c = *unsafe++) != 0) { |
24 | while(unsafe && (c = *unsafe++) != 0) { |
20 | if (c == '/' || c == ' ' || c == '&' || c == '|' || |
25 | if (c == '/' || c == ' ' || c == '&' || c == '|' || |
21 | c == '>' || c == '<' || c == '.') |
26 | c == '>' || c == '<' || c == '.') |
@@ -23,7 +28,7 @@ char *cache_safe_filename(const char *unsafe) |
23 | *s++ = c; |
28 | *s++ = c; |
24 | } |
29 | } |
25 | *s = '\0'; |
30 | *s = '\0'; |
26 | return buf; |
31 | return buf[bufidx]; |
27 | } |
32 | } |
28 | |
33 | |
29 | int cache_exist(struct cacheitem *item) |
34 | int cache_exist(struct cacheitem *item) |
|