summaryrefslogtreecommitdiff
path: root/network
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2014-10-17 14:43:25 +0200
committerGuillaume Seguin <guillaume@segu.in>2014-10-17 14:43:25 +0200
commit28507ed0cfab7f56c5ffc09a8c9d2329da56d278 (patch)
treefd45641a25ec2e5d4d83bea4094734e607839f6a /network
parent5a2104e89da99c845f89323e0a078a5a382f3320 (diff)
network/http-launch: Fix segfault
Message len was not updated when iterating in on_read_bytes
Diffstat (limited to 'network')
-rw-r--r--network/http-launch/http-launch.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/network/http-launch/http-launch.c b/network/http-launch/http-launch.c
index 63c575a..44871d3 100644
--- a/network/http-launch/http-launch.c
+++ b/network/http-launch/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--;
}
}