From 46a79b4f7a2d701dd110dca275c5a374d73b7308 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 7 Oct 2021 09:32:06 +0200 Subject: [PATCH] Merge pull request #4609 from mplough-kobold/master ERS: Fix off-by-one error when reading ERS header --- gdal/frmts/ers/ershdrnode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdal/frmts/ers/ershdrnode.cpp b/gdal/frmts/ers/ershdrnode.cpp index 58176f0d5a6e..dc7bcffb2174 100644 --- a/gdal/frmts/ers/ershdrnode.cpp +++ b/gdal/frmts/ers/ershdrnode.cpp @@ -175,7 +175,7 @@ int ERSHdrNode::ParseChildren( VSILFILE * fp, int nRecLevel ) if( (iOff = osLine.find_first_of( '=' )) != std::string::npos ) { - CPLString osName = iOff == 0 ? std::string() : osLine.substr(0,iOff-1); + CPLString osName = iOff == 0 ? std::string() : osLine.substr(0,iOff); osName.Trim(); CPLString osValue = osLine.c_str() + iOff + 1;