--- embedaddon/php/ext/standard/string.c 2013/07/22 01:32:05 1.1.1.3 +++ embedaddon/php/ext/standard/string.c 2014/06/15 20:03:57 1.1.1.5 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2013 The PHP Group | + | Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.1.1.3 2013/07/22 01:32:05 misho Exp $ */ +/* $Id: string.c,v 1.1.1.5 2014/06/15 20:03:57 misho Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -1441,6 +1441,19 @@ PHPAPI void php_basename(const char *s, size_t len, ch state = 0; cend = c; } +#if defined(PHP_WIN32) || defined(NETWARE) + /* Catch relative paths in c:file.txt style. They're not to confuse + with the NTFS streams. This part ensures also, that no drive + letter traversing happens. */ + } else if ((*c == ':' && (c - comp == 1))) { + if (state == 0) { + comp = c; + state = 1; + } else { + cend = c; + state = 0; + } +#endif } else { if (state == 0) { comp = c; @@ -1581,7 +1594,7 @@ PHP_FUNCTION(pathinfo) const char *p; int idx; - /* Have we alrady looked up the basename? */ + /* Have we already looked up the basename? */ if (!have_basename && !ret) { php_basename(path, path_len, NULL, 0, &ret, &ret_len TSRMLS_CC); } @@ -3253,7 +3266,7 @@ static void php_similar_str(const char *txt1, int len1 static int php_similar_char(const char *txt1, int len1, const char *txt2, int len2) { int sum; - int pos1, pos2, max; + int pos1 = 0, pos2 = 0, max; php_similar_str(txt1, len1, txt2, len2, &pos1, &pos2, &max); if ((sum = max)) { @@ -4613,7 +4626,7 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, int len, i char *tbuf, *buf, *p, *tp, *rp, c, lc; int br, i=0, depth=0, in_q = 0; int state = 0, pos; - char *allow_free; + char *allow_free = NULL; if (stateptr) state = *stateptr;