Merge lp:~mterry/lightdm/write-crash into lp:lightdm

Proposed by Michael Terry
Status: Merged
Merged at revision: 1063
Proposed branch: lp:~mterry/lightdm/write-crash
Merge into: lp:lightdm
Diff against target: 19 lines (+2/-2)
1 file modified
src/xauthority.c (+2/-2)
To merge this branch: bzr merge lp:~mterry/lightdm/write-crash
Reviewer Review Type Date Requested Status
LightDM Development Team Pending
Review via email: mp+72068@code.launchpad.net

Description of the change

This crash was triggered by a false-negative when writing the xauthority. The error code path was run with a NULL error.

I believe I have found it, though I did not actually reproduce the crash. But code analysis led me to this.

g_output_stream_write returns -1 on error. A zero return isn't an error (though it will only be returned if the count argument is zero).

I suspect that for the user that hit this crash, some empty string was trying to be written.

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Nice catch. Feel free to merge these changes directly in the future.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/xauthority.c'
2--- src/xauthority.c 2011-07-25 11:40:18 +0000
3+++ src/xauthority.c 2011-08-18 16:31:24 +0000
4@@ -206,13 +206,13 @@
5
6 data[0] = value >> 8;
7 data[1] = value & 0xFF;
8- return g_output_stream_write (stream, data, 2, NULL, error);
9+ return g_output_stream_write (stream, data, 2, NULL, error) >= 0;
10 }
11
12 static gboolean
13 write_data (GOutputStream *stream, const guint8 *data, gsize data_length, GError **error)
14 {
15- return g_output_stream_write (stream, data, data_length, NULL, error);
16+ return g_output_stream_write (stream, data, data_length, NULL, error) >= 0;
17 }
18
19 static gboolean

Subscribers

People subscribed via source and target branches