Commit 694b3a26 authored by Richard Hughes's avatar Richard Hughes
Browse files

trivial: Do no assert if we try to read from a fd with zero maximum size

parent e9a1d6f2
......@@ -177,9 +177,17 @@ fu_common_get_contents_fd (gint fd, gsize count, GError **error)
g_autoptr(GInputStream) stream = NULL;
g_return_val_if_fail (fd > 0, NULL);
g_return_val_if_fail (count > 0, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
/* this is invalid */
if (count == 0) {
g_set_error_literal (error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"A maximum read size must be specified");
return NULL;
}
/* read the entire fd to a data blob */
stream = g_unix_input_stream_new (fd, TRUE);
blob = g_input_stream_read_bytes (stream, count, NULL, &error_local);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment