From fb0afdb34b9c7c6f26aba666188a3111c0c5cd85 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Fri, 26 Aug 2016 16:21:05 -0300 Subject: [PATCH] Fix @validateByteRange initialization --- src/operators/validate_byte_range.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/operators/validate_byte_range.cc b/src/operators/validate_byte_range.cc index d3d2762d..069e58dd 100644 --- a/src/operators/validate_byte_range.cc +++ b/src/operators/validate_byte_range.cc @@ -24,7 +24,7 @@ namespace operators { bool ValidateByteRange::getRange(const std::string &rangeRepresentation, std::string *error) { - size_t pos = param.find_first_of("-"); + size_t pos = rangeRepresentation.find_first_of("-"); int start; int end; @@ -89,10 +89,13 @@ bool ValidateByteRange::init(const std::string &file, if (pos == std::string::npos) { getRange(param, error); + } else { + getRange(std::string(param, 0, pos), error); } while (pos != std::string::npos) { size_t next_pos = param.find_first_of(",", pos + 1); + if (next_pos == std::string::npos) { getRange(std::string(param, pos + 1, param.length() - (pos + 1)), error);