changeset 35803:3ad3aaeb1134 stable

streamclone: use readexactly when reading stream v2 Yuya Nishihara pointed out that it is safer.
author Boris Feld <boris.feld@octobus.net>
date Wed, 24 Jan 2018 21:44:31 +0100
parents bbc07357b567
children 2d3e486d09d0
files mercurial/streamclone.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/streamclone.py	Wed Jan 24 21:37:48 2018 +0100
+++ b/mercurial/streamclone.py	Wed Jan 24 21:44:31 2018 +0100
@@ -594,12 +594,12 @@
                     for vfs in vfsmap.values())
             with nested(*ctxs):
                 for i in range(filecount):
-                    src = fp.read(1)
+                    src = util.readexactly(fp, 1)
                     vfs = vfsmap[src]
                     namelen = util.uvarintdecodestream(fp)
                     datalen = util.uvarintdecodestream(fp)
 
-                    name = fp.read(namelen)
+                    name = util.readexactly(fp, namelen)
 
                     if repo.ui.debugflag:
                         repo.ui.debug('adding [%s] %s (%s)\n' %