forked from premiere/premiere-libtorrent
snprintf fix
This commit is contained in:
parent
c23fda2e2a
commit
970ab50e57
|
@ -142,8 +142,8 @@ namespace libtorrent
|
||||||
virtual char const* what() const { return "file renamed"; }
|
virtual char const* what() const { return "file renamed"; }
|
||||||
virtual std::string message() const
|
virtual std::string message() const
|
||||||
{
|
{
|
||||||
char msg[200];
|
char msg[200 + NAME_MAX];
|
||||||
snprintf(msg, 200, "%s: file %d renamed to %s", torrent_alert::message().c_str()
|
snprintf(msg, sizeof(msg), "%s: file %d renamed to %s", torrent_alert::message().c_str()
|
||||||
, index, name.c_str());
|
, index, name.c_str());
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
@ -168,8 +168,8 @@ namespace libtorrent
|
||||||
virtual char const* what() const { return "file rename failed"; }
|
virtual char const* what() const { return "file rename failed"; }
|
||||||
virtual std::string message() const
|
virtual std::string message() const
|
||||||
{
|
{
|
||||||
char ret[200];
|
char ret[200 + NAME_MAX];
|
||||||
snprintf(ret, 200, "%s: failed to rename file %d: %s"
|
snprintf(ret, sizeof(msg), "%s: failed to rename file %d: %s"
|
||||||
, torrent_alert::message().c_str(), index, msg.c_str());
|
, torrent_alert::message().c_str(), index, msg.c_str());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
// this is the maximum number of characters in a
|
// this is the maximum number of characters in a
|
||||||
// path element / filename on windows
|
// path element / filename on windows
|
||||||
#define NAME_MAX 255
|
#define NAME_MAX 255
|
||||||
#define snprintf _snprintf_s
|
#define snprintf _snprintf
|
||||||
#define strtoll _strtoi64
|
#define strtoll _strtoi64
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue