diff options
author | Guillaume Seguin <guillaume@segu.in> | 2014-10-17 14:43:25 +0200 |
---|---|---|
committer | Guillaume Seguin <guillaume@segu.in> | 2014-10-17 14:43:25 +0200 |
commit | 9930b4046df373dc5d6432f02dad737a91e87cf0 (patch) | |
tree | 788d13e8b82c6ff9102c7edee8abc3a901e3782c | |
parent | 37ba90a83b95822a78eb9863eac94325dbe7f3c5 (diff) |
Fix segfault
Message len was not updated when iterating in on_read_bytes
-rw-r--r-- | http-launch/src/http-launch.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/http-launch/src/http-launch.c b/http-launch/src/http-launch.c index 63c575a..44871d3 100644 --- a/http-launch/src/http-launch.c +++ b/http-launch/src/http-launch.c @@ -203,10 +203,11 @@ on_read_bytes (GPollableInputStream * stream, Client * client) return FALSE; } else if (g_error_matches (err, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK)) { guint8 *tmp = client->current_message->data; + guint tmp_len = client->current_message->len; g_clear_error (&err); - while (client->current_message->len > 3) { + while (tmp_len > 3) { if (tmp[0] == 0x0d && tmp[1] == 0x0a && tmp[2] == 0x0d && tmp[3] == 0x0a) { guint len; @@ -215,8 +216,10 @@ on_read_bytes (GPollableInputStream * stream, Client * client) client_message (client, (gchar *) client->current_message->data, len); g_byte_array_remove_range (client->current_message, 0, len); tmp = client->current_message->data; + tmp_len = client->current_message->len; } else { tmp++; + tmp_len--; } } |