From: Mikko Koppanen Date: Sun, 27 Dec 2009 00:43:33 +0000 (+0000) Subject: spprintf the dbname X-Git-Tag: php-5.4.0alpha1~191^2~2157 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1149ed8b32a130fd451f50de2259c1c82d831875;p=php spprintf the dbname use VCWD_ACCESS instead of access --- 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)