From: Rafael Roquetto Date: Tue, 11 Sep 2012 12:58:32 +0000 (-0300) Subject: QFileSystemEngine: fix realpath() buffer size X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f3707a5a0c4483b15e7bb2ba9f0e7d1913a713ee;p=profile%2Fivi%2Fqtbase.git QFileSystemEngine: fix realpath() buffer size realpath() returns at most PATH_MAX _plus_ the terminator. Change-Id: I4c2e3e166a5f476863ad8c6999800e6468535dbe Reviewed-by: Qt Doc Bot Reviewed-by: Thomas McGuire Reviewed-by: Giuseppe D'Angelo --- diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index 1bc3c4d..3d75b8c 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);