D13898: Use non deprecated fastInsert in file.cpp (first of many to come)

Stefan BrĂ¼ns noreply at phabricator.kde.org
Thu Jul 5 17:29:18 BST 2018


bruns added inline comments.

INLINE COMMENTS

> file.cpp:864
>              while (true) {
>                  ssize_t n = readlink(path.constData(), linkTargetBuffer.data(), bufferSize);
>                  if (n < 0 && errno != ERANGE) {

This is broken (although not new).

`buff.st_size` is the size of the target name **without** null byte.
readlink(..., .., bufferSize) thus will typically read exactly bufferSize bytes, thus n == bufferSize
As a result, the 'good' case in the branches below will not pass, and a resize(bufferSize *= 2) and another readlink will happen.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D13898

To: jtamate, dfaure, #frameworks
Cc: bruns, kde-frameworks-devel, michaelh, ngraham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180705/f9a5aec8/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list