pollita         Mon Apr  4 16:26:50 2005 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/main       streams.c 
  Log:
  MFH rev 1.72 (of main/streams/streams.c)
  
http://cvs.php.net/diff.php/php-src/main/streams.c?r1=1.125.2.93&r2=1.125.2.94&ty=u
Index: php-src/main/streams.c
diff -u php-src/main/streams.c:1.125.2.93 php-src/main/streams.c:1.125.2.94
--- php-src/main/streams.c:1.125.2.93   Tue Aug 31 11:32:09 2004
+++ php-src/main/streams.c      Mon Apr  4 16:26:49 2005
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.125.2.93 2004/08/31 15:32:09 stas Exp $ */
+/* $Id: streams.c,v 1.125.2.94 2005/04/04 20:26:49 pollita Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -2349,7 +2349,18 @@
 /* API for registering GLOBAL wrappers */
 PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper 
*wrapper TSRMLS_DC)
 {
-       return zend_hash_add(&url_stream_wrappers_hash, protocol, 
strlen(protocol), wrapper, sizeof(*wrapper), NULL);
+       int i, protocol_len = strlen(protocol);
+
+       for(i = 0; i < protocol_len; i++) {
+               if (!isalnum((int)protocol[i]) &&
+                       protocol[i] != '+' &&
+                       protocol[i] != '-' &&
+                       protocol[i] != '.') {
+                       return FAILURE;
+               }
+       }
+
+       return zend_hash_add(&url_stream_wrappers_hash, protocol, protocol_len, 
wrapper, sizeof(*wrapper), NULL);
 }
 
 PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC)
@@ -2360,6 +2371,17 @@
 /* API for registering VOLATILE wrappers */
 PHPAPI int php_register_url_stream_wrapper_volatile(char *protocol, 
php_stream_wrapper *wrapper TSRMLS_DC)
 {
+       int i, protocol_len = strlen(protocol);
+
+       for(i = 0; i < protocol_len; i++) {
+               if (!isalnum((int)protocol[i]) &&
+                       protocol[i] != '+' &&
+                       protocol[i] != '-' &&
+                       protocol[i] != '.') {
+                       return FAILURE;
+               }
+       }
+
        if (!FG(stream_wrappers)) {
                php_stream_wrapper tmpwrapper;
 
@@ -2368,7 +2390,7 @@
                zend_hash_copy(FG(stream_wrappers), &url_stream_wrappers_hash, 
NULL, &tmpwrapper, sizeof(php_stream_wrapper));
        }
 
-       return zend_hash_add(FG(stream_wrappers), protocol, strlen(protocol), 
wrapper, sizeof(*wrapper), NULL);
+       return zend_hash_add(FG(stream_wrappers), protocol, protocol_len, 
wrapper, sizeof(*wrapper), NULL);
 }
 /* }}} */
 

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

Reply via email to