Commit 6e33566c authored by Max Kellermann's avatar Max Kellermann

client/FileCommands: validate the given offset

parent 3b3c1d46
......@@ -205,6 +205,17 @@ read_stream_art(Response &r, const char *uri, size_t offset)
const offset_type art_file_size = is->GetSize();
if (offset >= art_file_size) {
if (offset > art_file_size) {
r.Error(ACK_ERROR_ARG, "Offset too large");
return CommandResult::ERROR;
} else {
r.Format("size: %" PRIoffset "\n", art_file_size);
r.WriteBinary(nullptr);
return CommandResult::OK;
}
}
uint8_t buffer[Response::MAX_BINARY_SIZE];
size_t read_size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment