summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikko Koppanen <mkoppanen@php.net>2009-12-27 00:43:33 +0000
committerMikko Koppanen <mkoppanen@php.net>2009-12-27 00:43:33 +0000
commit1e6695feb7037ae505be41f3a5b4e87dbc81093e (patch)
tree96766dbad7f688ec72c8e2bdea5353c398784267
parente9b1ab57a4a4632bf620be245f2e05d3eca3b913 (diff)
downloadphp-git-1e6695feb7037ae505be41f3a5b4e87dbc81093e.tar.gz
spprintf the dbname
use VCWD_ACCESS instead of access
-rw-r--r--ext/fileinfo/libmagic/apprentice.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c
index 030961aa61..21d8266a09 100644
--- a/ext/fileinfo/libmagic/apprentice.c
+++ b/ext/fileinfo/libmagic/apprentice.c
@@ -2120,7 +2120,7 @@ internal_loaded:
}
if (dbname) {
- free(dbname);
+ efree(dbname);
}
return ret;
@@ -2137,7 +2137,7 @@ error1:
}
error2:
if (dbname) {
- free(dbname);
+ efree(dbname);
}
return -1;
}
@@ -2195,7 +2195,7 @@ apprentice_compile(struct magic_set *ms, struct magic **magicp,
rv = 0;
out:
- free(dbname);
+ efree(dbname);
return rv;
}
@@ -2229,14 +2229,14 @@ mkdbname(struct magic_set *ms, const char *fn, int strip)
q++;
/* Compatibility with old code that looked in .mime */
if (ms->flags & MAGIC_MIME) {
- asprintf(&buf, "%.*s.mime%s", (int)(q - fn), fn, ext);
- if (access(buf, R_OK) != -1) {
+ spprintf(&buf, MAXPATHLEN, "%.*s.mime%s", (int)(q - fn), fn, ext);
+ if (VCWD_ACCESS(buf, R_OK) != -1) {
ms->flags &= MAGIC_MIME_TYPE;
return buf;
}
- free(buf);
+ efree(buf);
}
- asprintf(&buf, "%.*s%s", (int)(q - fn), fn, ext);
+ spprintf(&buf, MAXPATHLEN, "%.*s%s", (int)(q - fn), fn, ext);
/* Compatibility with old code that looked in .mime */
if (strstr(p, ".mime") != NULL)