On 5/25/20 9:02 PM, Daniel Kiper wrote:
> From: Olaf Hering <o...@aepfle.de>
> 
> A http transfer will hang if an error is returned. The error branch
> returns the value GRUB_ERR_NONE which is not expected by the caller.
> 
> Signed-off-by: Olaf Hering <o...@aepfle.de>
> Signed-off-by: Daniel Kiper <daniel.ki...@oracle.com>
> ---
>  grub-core/net/http.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/grub-core/net/http.c b/grub-core/net/http.c
> index b616cf40b..0d3da7501 100644
> --- a/grub-core/net/http.c
> +++ b/grub-core/net/http.c
> @@ -118,14 +118,14 @@ parse_line (grub_file_t file, http_data_t data, char 
> *ptr, grub_size_t len)
>       case 404:
>         data->err = GRUB_ERR_FILE_NOT_FOUND;
>         data->errmsg = grub_xasprintf (_("file `%s' not found"), 
> data->filename);
> -       return GRUB_ERR_NONE;
> +       return GRUB_ERR_FILE_NOT_FOUND;
>       default:
>         data->err = GRUB_ERR_NET_UNKNOWN_ERROR;
>         /* TRANSLATORS: GRUB HTTP code is pretty young. So even perfectly
>            valid answers like 403 will trigger this very generic message.  */
>         data->errmsg = grub_xasprintf (_("unsupported HTTP error %d: %s"),
>                                        code, ptr);
> -       return GRUB_ERR_NONE;
> +       return GRUB_ERR_FILE_READ_ERROR;
>       }
>        data->first_line_recv = 1;
>        return GRUB_ERR_NONE;
> 

There is one case that is still returning GRUB_ERR_NONE even when is taken as
an error and that is when the HTTP version != 1.1. Maybe fixing that as well?

Best regards,
-- 
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to