diff options
author | Moriyoshi Koizumi <moriyoshi@php.net> | 2003-02-24 22:39:47 +0000 |
---|---|---|
committer | Moriyoshi Koizumi <moriyoshi@php.net> | 2003-02-24 22:39:47 +0000 |
commit | b44b0b80e013f94186fd1b6de2d8f99390d962fc (patch) | |
tree | 687a743f78704a30a3d77e50c684cf0b7ec10c2e | |
parent | 8f341f6a194a4db6f6cc587cf624167321183a19 (diff) | |
download | php-git-b44b0b80e013f94186fd1b6de2d8f99390d962fc.tar.gz |
Made fgetss() binary safe too
-rw-r--r-- | ext/standard/file.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index b4f118b76c..24739957b9 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1675,6 +1675,7 @@ PHPAPI PHP_FUNCTION(fgetss) { zval **fd, **bytes, **allow=NULL; int len; + size_t actual_len, retval_len; char *buf; php_stream *stream; char *allowed_tags=NULL; @@ -1713,15 +1714,15 @@ PHPAPI PHP_FUNCTION(fgetss) /*needed because recv doesnt set null char at end*/ memset(buf, 0, len + 1); - if (php_stream_gets(stream, buf, len) == NULL) { + if (php_stream_get_line(stream, buf, len, &actual_len) == NULL) { efree(buf); RETURN_FALSE; } /* strlen() can be used here since we are doing it on the return of an fgets() anyway */ - php_strip_tags(buf, strlen(buf), &stream->fgetss_state, allowed_tags, allowed_tags_len); + retval_len = php_strip_tags(buf, actual_len, &stream->fgetss_state, allowed_tags, allowed_tags_len); - RETURN_STRING(buf, 0); + RETURN_STRINGL(buf, retval_len, 0); } /* }}} */ |