Skip to content

Commit

Permalink
Validate string position before using the index.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevcairiel committed Mar 29, 2014
1 parent 97f09e5 commit d6e642b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion common/DSUtilLite/CueSheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,18 @@ static string GetCueParam(string line, bool firstWord = false)
idx = line.find_first_of(delims, idx);
// Find beginning of param
idx = line.find_first_not_of(delims, idx);
if (idx == string::npos)
return string();
string param = line.substr(idx);
// trim spaces off the end
param = param.substr(0, param.find_last_not_of(delims) + 1);
// replace escaped quotes
str_replace(param, "\\\"", "\"");

if (firstWord) {
param = param.substr(0, param.find_first_of(delims));
idx = param.find_first_of(delims);
if (idx != string::npos)
param = param.substr(0, idx);
}
return param;
}
Expand Down

0 comments on commit d6e642b

Please sign in to comment.