diff options
author | Rafael Roquetto <rafael.roquetto.qnx@kdab.com> | 2012-09-11 09:58:32 -0300 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-11 17:40:37 +0200 |
commit | f3707a5a0c4483b15e7bb2ba9f0e7d1913a713ee (patch) | |
tree | efd8874ca9f3cb431898a9ad0349087886c33af6 /src/corelib/io | |
parent | 6e8e1da0a8267d2f8f568403e6ab9fe53b01cd29 (diff) |
QFileSystemEngine: fix realpath() buffer size
realpath() returns at most PATH_MAX _plus_ the terminator.
Change-Id: I4c2e3e166a5f476863ad8c6999800e6468535dbe
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qfilesystemengine_unix.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 1bc3c4dea6..3d75b8cb09 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -194,7 +194,7 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry, # if _POSIX_VERSION >= 200801L ret = realpath(entry.nativeFilePath().constData(), (char*)0); # else - ret = (char*)malloc(PATH_MAX); + ret = (char*)malloc(PATH_MAX + 1); if (realpath(entry.nativeFilePath().constData(), (char*)ret) == 0) { const int savedErrno = errno; // errno is checked below, and free() might change it free(ret); |