On 25/02/2024 10:28, NetSurf Browser Project (Commit Mailer) wrote:
> diff --git a/content/handlers/html/form.c b/content/handlers/html/form.c
> index afa40ac2e..8c8120877 100644
> --- a/content/handlers/html/form.c
> +++ b/content/handlers/html/form.c
> @@ -2002,13 +2002,18 @@ void form_radio_set(struct form_control *radio)
> if (radio->selected)
> return;
>
> - for (control = radio->form->controls; control;
> - control = control->next) {
> + for (control = radio->form->controls;
> + control != NULL;
> + control = control->next) {
> if (control->type != GADGET_RADIO)
> continue;
> +
> if (control == radio)
> continue;
> - if (strcmp(control->name, radio->name) != 0)
> +
> + if ((control->name != NULL) &&
> + (radio->name != NULL) &&
> + strcmp(control->name, radio->name) != 0)
> continue;
>
> if (control->selected) {
I think this now erroneously treats inputs with no name as being part of
the same radio button group[1]. If either input has no name, then they
cannot be part of the same group, so you probably wanted:
if (control->name == NULL || radio->name == NULL || strcmp(...))
The spec also treats empty names in the same way (i.e. the name
attribute is present, but its value is the empty string), so that
probably wants to be taken into account here, too.
J.
1. https://html.spec.whatwg.org/multipage/input.html#radio-button-group
No comments:
Post a Comment