]> git.lyx.org Git - lyx.git/commitdiff
Limit the size of strings we read from RCS
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 11 Mar 2017 19:46:32 +0000 (20:46 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 11 Mar 2017 19:46:32 +0000 (20:46 +0100)
This calms down Coverity which fears than an evil RCS repository would break LyX.

src/VCBackend.cpp

index b395a0d2b210563cabfb2ef518b6d7a168f1688d..3eeb3d6a3ef3ccccf1db19aecfdd76ede3b1e8d7 100644 (file)
@@ -170,6 +170,8 @@ void RCS::scanMaster()
        LYXERR(Debug::LYXVC, "LyXVC::RCS: scanMaster: " << master_);
 
        ifstream ifs(master_.toFilesystemEncoding().c_str());
+       // limit the size of strings we read to avoid memory problems
+       ifs >> setw(65636);
 
        string token;
        bool read_enough = false;