diff --git a/configure.in b/configure.in index bef46cf63..4ce1301e8 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ AC_PREREQ(2.59) AC_INIT(src/torrent.cpp) -AM_INIT_AUTOMAKE(libtorrent, 0.9) +AM_INIT_AUTOMAKE(libtorrent, 0.9.1) AM_CONFIG_HEADER(config.h) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index c24772410..4a97e8f04 100755 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -1358,7 +1358,9 @@ namespace libtorrent if (total_size > 500 * 1024) throw protocol_error("metadata size larger than 500 kB"); - if (offset > total_size) + if (total_size <= 0) + throw protocol_error("invalid metadata size"); + if (offset > total_size || offset < 0) throw protocol_error("invalid metadata offset"); if (offset + data_size > total_size) throw protocol_error("invalid metadata message");