Skip to content

Commit

Permalink
Translations: prevent remote crash with invalid translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekdohibs committed Aug 25, 2017
1 parent d3f1743 commit 6761e21
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/util/string.cpp
Expand Up @@ -866,7 +866,12 @@ void translate_string(const std::wstring &s, const std::wstring &textdomain,
// Here we have an argument; get its index and add the translated argument to the output.
int arg_index = toutput[j] - L'1';
++j;
result << args[arg_index];
if (0 <= arg_index && (size_t)arg_index < args.size()) {
result << args[arg_index];
} else {
// This is not allowed: show an error message
errorstream << "Ignoring out-of-bounds argument escape sequence in translation" << std::endl;
}
}
res = result.str();
}
Expand Down

0 comments on commit 6761e21

Please sign in to comment.