Skip to content

Commit 4730501

Browse files
committed
ext/standard: pass string length
1 parent 3182b2e commit 4730501

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

ext/spl/spl_directory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2494,7 +2494,7 @@ PHP_METHOD(SplFileObject, fscanf)
24942494
RETURN_THROWS();
24952495
}
24962496

2497-
php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), format_str, 1, num_varargs, varargs, return_value);
2497+
php_sscanf_internal(ZSTR_VAL(intern->u.file.current_line), ZSTR_LEN(intern->u.file.current_line), format_str, 1, num_varargs, varargs, return_value);
24982498
}
24992499
/* }}} */
25002500

ext/standard/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ PHP_FUNCTION(fscanf)
956956
RETURN_FALSE;
957957
}
958958

959-
php_sscanf_internal(buf, format, 2, argc, args, return_value);
959+
php_sscanf_internal(buf, len, format, 2, argc, args, return_value);
960960

961961
efree(buf);
962962
}

ext/standard/scanf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ static bool isFormatStringValid(const zend_string *zstr_format, uint32_t format_
595595
* return_value set with the results of the scan
596596
*/
597597

598-
PHPAPI int php_sscanf_internal(const char *string, const zend_string *zstr_format, uint32_t format_arg_num,
598+
PHPAPI int php_sscanf_internal(const char *string, size_t string_len, const zend_string *zstr_format, uint32_t format_arg_num,
599599
uint32_t argCount, zval *args,
600600
zval *return_value)
601601
{

ext/standard/scanf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* The following are here solely for the benefit of the scanf type functions
3434
* e.g. fscanf
3535
*/
36-
PHPAPI int php_sscanf_internal(const char *string, const zend_string *format, uint32_t format_arg_num, uint32_t argCount, zval *args,
36+
PHPAPI int php_sscanf_internal(const char *string, size_t string_len, const zend_string *format, uint32_t format_arg_num, uint32_t argCount, zval *args,
3737
zval *return_value);
3838

3939

ext/standard/string.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5871,7 +5871,7 @@ PHP_FUNCTION(sscanf)
58715871
Z_PARAM_VARIADIC('*', args, num_args)
58725872
ZEND_PARSE_PARAMETERS_END();
58735873

5874-
php_sscanf_internal(str, format, 2, num_args, args, return_value);
5874+
php_sscanf_internal(str, str_len, format, 2, num_args, args, return_value);
58755875

58765876
}
58775877
/* }}} */

0 commit comments

Comments
 (0)