fixed unchecked input

This commit is contained in:
Arvid Norberg 2005-10-18 18:16:36 +00:00
parent 9d426441f1
commit 6d7236fbea
2 changed files with 4 additions and 2 deletions

View File

@ -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)

View File

@ -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");