mkoppanen                                Sun, 27 Dec 2009 00:43:33 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=292682

Log:
spprintf the dbname
use VCWD_ACCESS instead of access

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/apprentice.c
    U   php/php-src/trunk/ext/fileinfo/libmagic/apprentice.c

Modified: php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/apprentice.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/apprentice.c     
2009-12-26 23:59:19 UTC (rev 292681)
+++ php/php-src/branches/PHP_5_3/ext/fileinfo/libmagic/apprentice.c     
2009-12-27 00:43:33 UTC (rev 292682)
@@ -2120,7 +2120,7 @@
        }

        if (dbname) {
-               free(dbname);
+               efree(dbname);
        }
        return ret;

@@ -2137,7 +2137,7 @@
        }
 error2:
        if (dbname) {
-               free(dbname);
+               efree(dbname);
        }
        return -1;
 }
@@ -2195,7 +2195,7 @@

        rv = 0;
 out:
-       free(dbname);
+       efree(dbname);
        return rv;
 }

@@ -2229,14 +2229,14 @@
        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)

Modified: php/php-src/trunk/ext/fileinfo/libmagic/apprentice.c
===================================================================
--- php/php-src/trunk/ext/fileinfo/libmagic/apprentice.c        2009-12-26 
23:59:19 UTC (rev 292681)
+++ php/php-src/trunk/ext/fileinfo/libmagic/apprentice.c        2009-12-27 
00:43:33 UTC (rev 292682)
@@ -2120,7 +2120,7 @@
        }

        if (dbname) {
-               free(dbname);
+               efree(dbname);
        }
        return ret;

@@ -2137,7 +2137,7 @@
        }
 error2:
        if (dbname) {
-               free(dbname);
+               efree(dbname);
        }
        return -1;
 }
@@ -2195,7 +2195,7 @@

        rv = 0;
 out:
-       free(dbname);
+       efree(dbname);
        return rv;
 }

@@ -2229,14 +2229,14 @@
        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)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to