File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -194,10 +194,11 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length)
194
194
195
195
if (pp - p > 0 && pp - p < 6 && (pp == ue || * pp == '/' )) {
196
196
zend_long port ;
197
+ char * end ;
197
198
memcpy (port_buf , p , (pp - p ));
198
199
port_buf [pp - p ] = '\0' ;
199
- port = ZEND_STRTOL (port_buf , NULL , 10 );
200
- if (port > 0 && port <= 65535 ) {
200
+ port = ZEND_STRTOL (port_buf , & end , 10 );
201
+ if (port >= 0 && port <= 65535 && end != port_buf ) {
201
202
ret -> port = (unsigned short ) port ;
202
203
if (s + 1 < ue && * s == '/' && * (s + 1 ) == '/' ) { /* relative-scheme URL */
203
204
s += 2 ;
@@ -258,10 +259,11 @@ PHPAPI php_url *php_url_parse_ex(char const *str, size_t length)
258
259
return NULL ;
259
260
} else if (e - p > 0 ) {
260
261
zend_long port ;
262
+ char * end ;
261
263
memcpy (port_buf , p , (e - p ));
262
264
port_buf [e - p ] = '\0' ;
263
- port = ZEND_STRTOL (port_buf , NULL , 10 );
264
- if (( port > 0 && port <= 65535 ) || ( port == 0 && * port_buf == '0' && e - p == 1 ) ) {
265
+ port = ZEND_STRTOL (port_buf , & end , 10 );
266
+ if (port >= 0 && port <= 65535 && end != port_buf ) {
265
267
ret -> port = (unsigned short )port ;
266
268
} else {
267
269
php_url_free (ret );
You can’t perform that action at this time.
0 commit comments