Changeset 874


Ignore:
Timestamp:
2012-03-31T20:26:26+02:00 (3 years ago)
Author:
moo
Message:

missing zero terminator for filename

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xcache.c

    r870 r874  
    912912/* }}} */
    913913
    914 #define XC_INCLUDE_PATH_XSTAT_FUNC(name) zend_bool name(const char *filepath, size_t absolute_path_len, void *data TSRMLS_DC)
     914#define XC_INCLUDE_PATH_XSTAT_FUNC(name) zend_bool name(const char *filepath, size_t filepath_len, void *data TSRMLS_DC)
    915915typedef XC_INCLUDE_PATH_XSTAT_FUNC((*include_path_xstat_func_t));
    916916static zend_bool xc_include_path_apply(const char *filepath, char *path_buffer, include_path_xstat_func_t xstat_func, void *data TSRMLS_DC) /* {{{ */
     
    918918    char *paths, *path;
    919919    char *tokbuf;
    920     size_t absolute_path_len;
     920    size_t path_buffer_len;
    921921    int size = strlen(PG(include_path)) + 1;
    922922    char tokens[] = { DEFAULT_DIR_SEPARATOR, '\0' };
     
    928928
    929929    for (path = php_strtok_r(paths, tokens, &tokbuf); path; path = php_strtok_r(NULL, tokens, &tokbuf)) {
    930         absolute_path_len = snprintf(path_buffer, MAXPATHLEN, "%s/%s", path, filepath);
    931         if (absolute_path_len < MAXPATHLEN - 1) {
    932             if (xstat_func(path_buffer, absolute_path_len, data)) {
     930        path_buffer_len = snprintf(path_buffer, MAXPATHLEN, "%s/%s", path, filepath);
     931        if (path_buffer_len < MAXPATHLEN - 1) {
     932            if (xstat_func(path_buffer, path_buffer_len, data)) {
    933933                ret = 1;
    934934                goto finish;
     
    950950                        memcpy(path_buffer, executed_filename, dirname_len);
    951951                        memcpy(path_buffer + dirname_len, filepath, filename_len);
    952                         absolute_path_len = dirname_len + filename_len;
    953                         if (xstat_func(path_buffer, absolute_path_len, data) == 0) {
     952                        path_buffer_len = dirname_len + filename_len;
     953                        path_buffer[path_buffer_len] = '\0';
     954                        if (xstat_func(path_buffer, path_buffer_len, data) == 0) {
    954955                            ret = 1;
    955956                            goto finish;
Note: See TracChangeset for help on using the changeset viewer.