Merge compiz:mitya57/fix-gcc-stringop-truncation-error into compiz:master

Proposed by Dmitry Shachnev
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 3c1075eee923c7b466d4f4f390241a9f072ea554
Merged at revision: 71d4a9b2d4169743a613fe2835e39abc03019624
Proposed branch: compiz:mitya57/fix-gcc-stringop-truncation-error
Merge into: compiz:master
Diff against target: 12 lines (+1/-1)
1 file modified
plugins/session/src/session.cpp (+1/-1)
Reviewer Review Type Date Requested Status
Alberts Muktupāvels Approve
Marco Trevisan (Treviño) Pending
Compiz Maintainers Pending
Review via email: mp+363211@code.launchpad.net

Commit message

session: Fix GCC -Wstringop-truncation error.

Description of the change

session: Fix GCC -Wstringop-truncation error.

There is no sense in calling strncpy when nItems == 0.

The correct check is copied from TitleinfoScreen::getUtf8Property().

To post a comment you must log in.
Revision history for this message
Alberts Muktupāvels (muktupavels) :
review: Approve
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/plugins/session/src/session.cpp b/plugins/session/src/session.cpp
2index 7d423e2..50ccdef 100644
3--- a/plugins/session/src/session.cpp
4+++ b/plugins/session/src/session.cpp
5@@ -51,7 +51,7 @@ SessionScreen::getUtf8Property (Window id,
6 if (result != Success)
7 return false;
8
9- if (type == Atoms::utf8String && format != 8 && nItems == 0)
10+ if (type == Atoms::utf8String && format == 8 && val && nItems > 0)
11 {
12 char valueString[nItems + 1];
13

Subscribers

People subscribed via source and target branches