diff options
author | Chris Wilson <chris+github@qwirx.com> | 2011-03-27 01:01:34 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2011-03-27 01:01:34 +0000 |
commit | 0fe90245a77295226d0967bc0702e591afe2afa7 (patch) | |
tree | 69b1402bac421520921513cf13ed06e2535e47ec /lib/common/FdGetLine.cpp | |
parent | a6ea3ec4d7f048ae16637532a1e9d7269b623eba (diff) |
Fix off-by-one errors caught by MSVC.
Diffstat (limited to 'lib/common/FdGetLine.cpp')
-rw-r--r-- | lib/common/FdGetLine.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/common/FdGetLine.cpp b/lib/common/FdGetLine.cpp index 9b53288b..9add2bd1 100644 --- a/lib/common/FdGetLine.cpp +++ b/lib/common/FdGetLine.cpp @@ -185,8 +185,13 @@ std::string FdGetLine::GetLine(bool Preprocess) { begin++; } - if(!iw(r[end])) end--; - while(end > begin && iw(r[end])) + + if(end < size && !iw(r[end])) + { + end--; + } + + while(end > begin && end < size && iw(r[end])) { end--; } |