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 15, 2024
1 parent 62661b7 commit ba00c50
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 ba00c50

Please sign in to comment.