Skip to content

Commit

Permalink
Fix inverted logic.
Browse files Browse the repository at this point in the history
Don't write more into a buffer than it can hold.

https://bugzilla.gnome.org/show_bug.cgi?id=791124
  • Loading branch information
coypoop authored and mgorse committed Dec 4, 2017
1 parent 43b8453 commit c2e87fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bus/at-spi-bus-launcher.c
Expand Up @@ -244,7 +244,7 @@ unix_read_all_fd_to_string (int fd,
{
ssize_t bytes_read;

while (max_bytes > 1 && (bytes_read = read (fd, buf, MAX (4096, max_bytes - 1))))
while (max_bytes > 1 && (bytes_read = read (fd, buf, MIN (4096, max_bytes - 1))))
{
if (bytes_read < 0)
return FALSE;
Expand Down

0 comments on commit c2e87fe

Please sign in to comment.