Skip to content

Commit

Permalink
Added check to make sure hash is valid hex (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
deep9977 authored Nov 3, 2024
1 parent 87c0295 commit d02ee3e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/project_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,14 @@ Project::Project(const Project *parent, const std::string &path, bool build) : p
algo.push_back(ch);
}
key = "URL_HASH";
if (value.empty()) {
throw_key_error("Empty hash value", argItr.first, argItr.second);
}
for (char c : value) {
if (!std::isxdigit(c)) {
throw_key_error("Hash value must be a hex string", argItr.first, argItr.second);
}
}
value = algo + "=" + value;
} else if (key == "hash") {
key = "URL_HASH";
Expand Down

0 comments on commit d02ee3e

Please sign in to comment.