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

Proposed by Daniel van Vugt
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 Approve
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.
Revision history for this message
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
=== modified file 'src/main.cpp'
--- src/main.cpp 2012-06-21 07:13:25 +0000
+++ src/main.cpp 2012-06-27 09:27:20 +0000
@@ -213,8 +213,12 @@
213 const char *bin = argv[0];213 const char *bin = argv[0];
214#ifdef __linux__214#ifdef __linux__
215 char exe[PATH_MAX];215 char exe[PATH_MAX];
216 if (readlink ("/proc/self/exe", exe, sizeof(exe)-1) > 0)216 ssize_t len = readlink ("/proc/self/exe", exe, sizeof(exe)-1);
217 if (len > 0)
218 {
219 exe[len] = '\0';
217 bin = exe;220 bin = exe;
221 }
218#endif222#endif
219 if (strchr (bin, '/')) // dirname needs a '/' to work reliably223 if (strchr (bin, '/')) // dirname needs a '/' to work reliably
220 {224 {

Subscribers

People subscribed via source and target branches