[njs] Improved reading of pseudofiles.
Dmitry Volyntsev
xeioex at nginx.com
Fri Apr 17 17:04:43 UTC 2020
details: https://hg.nginx.org/njs/rev/f68270171435
branches:
changeset: 1375:f68270171435
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Fri Apr 17 17:04:18 2020 +0000
description:
Improved reading of pseudofiles.
diffstat:
src/njs_fs.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diffs (16 lines):
diff -r e077780227e0 -r f68270171435 src/njs_fs.c
--- a/src/njs_fs.c Fri Apr 17 17:03:59 2020 +0000
+++ b/src/njs_fs.c Fri Apr 17 17:04:18 2020 +0000
@@ -233,6 +233,12 @@ njs_fs_read_file(njs_vm_t *vm, njs_value
goto done;
}
+ if (njs_slow_path(data.length < size)) {
+ /* Pseudo-files may return less data than declared by st_size. */
+ njs_string_truncate(&retval, data.length);
+ }
+
+ size = data.length;
start = data.start;
} else {
More information about the nginx-devel
mailing list