Merge lp:~vanvugt/compiz/fix-1018302 into lp:compiz/0.9.8

Proposed by Daniel van Vugt on 2012-06-27
Status: Merged
Merged at revision: 3262
Proposed branch: lp:~vanvugt/compiz/fix-1018302
Merge into: lp:compiz/0.9.8
Diff against target: 17 lines (+5/-1)
1 file modified
src/main.cpp (+5/-1)
To merge this branch: bzr merge lp:~vanvugt/compiz/fix-1018302
Reviewer Review Type Date Requested Status
Sam Spilsbury 2012-06-27 Approve on 2012-06-27
Review via email: mp+112299@code.launchpad.net

Description of the change

Fix potentially unterminated string leading to an uninitialized memory
read (LP: #1018302)

This could cause compiz to crash on startup.

To post a comment you must log in.
Sam Spilsbury (smspillaz) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/main.cpp'
2--- src/main.cpp 2012-06-21 07:13:25 +0000
3+++ src/main.cpp 2012-06-27 09:27:20 +0000
4@@ -213,8 +213,12 @@
5 const char *bin = argv[0];
6 #ifdef __linux__
7 char exe[PATH_MAX];
8- if (readlink ("/proc/self/exe", exe, sizeof(exe)-1) > 0)
9+ ssize_t len = readlink ("/proc/self/exe", exe, sizeof(exe)-1);
10+ if (len > 0)
11+ {
12+ exe[len] = '\0';
13 bin = exe;
14+ }
15 #endif
16 if (strchr (bin, '/')) // dirname needs a '/' to work reliably
17 {

Subscribers

People subscribed via source and target branches