diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 3412cdd1c..91ae57666 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -142,8 +142,8 @@ namespace libtorrent virtual char const* what() const { return "file renamed"; } virtual std::string message() const { - char msg[200]; - snprintf(msg, 200, "%s: file %d renamed to %s", torrent_alert::message().c_str() + char msg[200 + NAME_MAX]; + snprintf(msg, sizeof(msg), "%s: file %d renamed to %s", torrent_alert::message().c_str() , index, name.c_str()); return msg; } @@ -168,8 +168,8 @@ namespace libtorrent virtual char const* what() const { return "file rename failed"; } virtual std::string message() const { - char ret[200]; - snprintf(ret, 200, "%s: failed to rename file %d: %s" + char ret[200 + NAME_MAX]; + snprintf(ret, sizeof(msg), "%s: failed to rename file %d: %s" , torrent_alert::message().c_str(), index, msg.c_str()); return ret; } diff --git a/include/libtorrent/config.hpp b/include/libtorrent/config.hpp index 5df039fc4..9bb496635 100644 --- a/include/libtorrent/config.hpp +++ b/include/libtorrent/config.hpp @@ -102,7 +102,7 @@ POSSIBILITY OF SUCH DAMAGE. // this is the maximum number of characters in a // path element / filename on windows #define NAME_MAX 255 -#define snprintf _snprintf_s +#define snprintf _snprintf #define strtoll _strtoi64 #endif