Skip to content

Commit

Permalink
avoid accessing a temp QString via QStringView after it is deleted
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed May 14, 2024
1 parent c8d756e commit 3d93ecb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/csync/csync_exclude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QString &path, bool exclu
{
/* split up the path */
QStringView bname(path);
int lastSlash = path.lastIndexOf(QLatin1Char('/'));
int lastSlash = bname.lastIndexOf(QLatin1Char('/'));

Check warning on line 137 in src/csync/csync_exclude.cpp

View workflow job for this annotation

GitHub Actions / build

src/csync/csync_exclude.cpp:137:9 [cppcoreguidelines-init-variables]

variable 'lastSlash' is not initialized
if (lastSlash >= 0) {
bname = path.mid(lastSlash + 1);
bname = bname.mid(lastSlash + 1);
}

qsizetype blen = bname.size();
Expand Down

0 comments on commit 3d93ecb

Please sign in to comment.