[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-frameworks-devel
Subject: D24489: KAutosaveFile not respecting maximum filename length
From: Jean-Baptiste Mardelle <noreply () phabricator ! kde ! org>
Date: 2019-10-08 11:16:29
Message-ID: 46c1e021ebbe984a60a46ea140ef8d94 () localhost ! localdomain
[Download RAW message or body]
[Attachment #2 (text/plain)]
mardelle created this revision.
mardelle added a reviewer: Frameworks.
mardelle added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
mardelle requested review of this revision.
REVISION SUMMARY
There are 2 different issues in current code regarding maximum filename length:
1- We use FILENAME_MAX which is defined as 4096, while most filesystems have a max \
length of 256. Replacing FILENAME_MAX with NAME_MAX fixes this first problem (could \
not test on Windows if it works)
2- We are calculating the maximum length on the UTF-8 string, then encoding to \
percent encoding. This can result in longer strings since single characters will be \
replaced by a percent string. So in some situations, we end up with a string longer \
than allowed. Doing the percent encoding before length calculation fixes the problem. \
This fixes the follwing bug: https://bugs.kde.org/show_bug.cgi?id=412519
TEST PLAN
Bug is fixed with the changes
REPOSITORY
R244 KCoreAddons
REVISION DETAIL
https://phabricator.kde.org/D24489
AFFECTED FILES
src/lib/io/kautosavefile.cpp
To: mardelle, #frameworks
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
[Attachment #3 (text/html)]
<table><tr><td style="">mardelle created this revision.<br />mardelle added a \
reviewer: Frameworks.<br />mardelle added a project: Frameworks.<br />Herald added a \
subscriber: kde-frameworks-devel.<br />mardelle requested review of this revision. \
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: \
right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: \
#F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: \
inline-block; border: 1px solid rgba(71,87,120,.2);" \
href="https://phabricator.kde.org/D24489">View Revision</a></tr></table><br \
/><div><strong>REVISION SUMMARY</strong><div><p>There are 2 different issues in \
current code regarding maximum filename length:</p>
<p>1- We use FILENAME_MAX which is defined as 4096, while most filesystems have a max \
length of 256. Replacing FILENAME_MAX with NAME_MAX fixes this first problem (could \
not test on Windows if it works)</p>
<p>2- We are calculating the maximum length on the UTF-8 string, then encoding to \
percent encoding. This can result in longer strings since single characters will be \
replaced by a percent string. So in some situations, we end up with a string longer \
than allowed. Doing the percent encoding before length calculation fixes the \
problem.</p>
<p>This fixes the follwing bug: <a href="https://bugs.kde.org/show_bug.cgi?id=412519" \
class="remarkup-link" target="_blank" \
rel="noreferrer">https://bugs.kde.org/show_bug.cgi?id=412519</a></p></div></div><br \
/><div><strong>TEST PLAN</strong><div><p>Bug is fixed with the \
changes</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R244 \
KCoreAddons</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a \
href="https://phabricator.kde.org/D24489">https://phabricator.kde.org/D24489</a></div></div><br \
/><div><strong>AFFECTED \
FILES</strong><div><div>src/lib/io/kautosavefile.cpp</div></div></div><br \
/><div><strong>To: </strong>mardelle, Frameworks<br /><strong>Cc: \
</strong>kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns<br /></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic