Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Commit

Permalink
GDataInputStream: don't segfault on async line reads
Browse files Browse the repository at this point in the history
If an async line read fails, it returns NULL. In that case, we
must return NULL before validating the line, or we segfault.

https://bugzilla.gnome.org/show_bug.cgi?id=658484
  • Loading branch information
gcampax authored and Matthias Clasen committed Mar 11, 2012
1 parent 125ceb1 commit 14ddbfc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gio/gdatainputstream.c
Expand Up @@ -1284,6 +1284,9 @@ g_data_input_stream_read_line_finish_utf8 (GDataInputStream *stream,
gchar *res;

res = g_data_input_stream_read_line_finish (stream, result, length, error);
if (!res)
return NULL;

if (!g_utf8_validate (res, -1, NULL))
{
g_set_error_literal (error, G_CONVERT_ERROR,
Expand Down

0 comments on commit 14ddbfc

Please sign in to comment.