Skip to content
Snippets Groups Projects
Commit 030fb7ba authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

main: fix size of buffer in call to g_input_stream_read()

if there was a remainder in the buffer from a previous iteration,
make sure not to fill too much data and go past the end of the buffer
parent 785d049f
No related branches found
No related tags found
No related merge requests found
......@@ -163,7 +163,8 @@ parse_commands_file (struct WpDaemonData *d, GInputStream * stream,
linestart = cur = buffer;
do {
bytes_read = g_input_stream_read (stream, cur, sizeof (buffer), NULL, error);
bytes_read = g_input_stream_read (stream, cur,
sizeof (buffer) - (cur - linestart), NULL, error);
if (bytes_read < 0)
return FALSE;
else if (bytes_read == 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment