Skip to content

Commit

Permalink
APREPRO: Check for valid index to get_word()
Browse files Browse the repository at this point in the history
  • Loading branch information
gdsjaar committed Oct 18, 2024
1 parent c253bb9 commit 63814bd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/seacas/libraries/aprepro_lib/apr_builtin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,10 @@ namespace SEAMS {
auto &tokens = get_tokenized_strings(string, delm);

auto in = static_cast<size_t>(n);
if (in == 0) {
aprepro->error("Index to get_word must be positive.", false);
return "";
}
if (tokens.size() >= in) {
char *word = nullptr;
new_string(tokens[in - 1], &word);
Expand Down

0 comments on commit 63814bd

Please sign in to comment.