From fe3200ed071d46e43f159d108ede96c5a5eb4ce8 Mon Sep 17 00:00:00 2001 From: Sterling Hughes Date: Wed, 27 Nov 2002 20:32:26 +0000 Subject: [PATCH] MFH --- ext/standard/file.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/ext/standard/file.c b/ext/standard/file.c index e08c3c0ee3..a1c923d332 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1484,27 +1484,23 @@ PHP_FUNCTION(fscanf) RETURN_FALSE; } - len = SCAN_MAX_FSCANF_BUFSIZE; - buf = emalloc(len + 1); - /* needed because recv doesnt put a null at the end*/ - memset(buf, 0, len+1); - - if (php_stream_gets((php_stream *) what, buf, len) == NULL) { - efree(buf); + buf = php_stream_get_line((php_stream *) what, NULL, 0, &len); + if (buf == NULL) { RETURN_FALSE; } convert_to_string_ex(format_string); result = php_sscanf_internal(buf, Z_STRVAL_PP(format_string), argCount, args, 2, &return_value TSRMLS_CC); + efree(args); efree(buf); + if (SCAN_ERROR_WRONG_PARAM_COUNT == result) { - WRONG_PARAM_COUNT + WRONG_PARAM_COUNT; } - } /* }}} */ -- 2.50.1