1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 15:27:54 +00:00

Null terminate the wide string in torrent creator.

This commit is contained in:
sledgehammer999 2013-01-23 17:30:44 +02:00
parent e7125d21cb
commit ed26846a54

View File

@ -130,8 +130,9 @@ void TorrentCreatorThread::run() {
// create the torrent and print it to out // create the torrent and print it to out
qDebug("Saving to %s", qPrintable(save_path)); qDebug("Saving to %s", qPrintable(save_path));
#ifdef _MSC_VER #ifdef _MSC_VER
wchar_t *wsave_path = new wchar_t[save_path.length()]; wchar_t *wsave_path = new wchar_t[save_path.length()+1];
save_path.toWCharArray(wsave_path); int len = save_path.toWCharArray(wsave_path);
wsave_path[len+1] = '\0';
std::ofstream outfile(wsave_path, std::ios_base::out|std::ios_base::binary); std::ofstream outfile(wsave_path, std::ios_base::out|std::ios_base::binary);
delete[] wsave_path; delete[] wsave_path;
#else #else