From bce0aa6fc9250395a899996b5e9067b4f370c40d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 25 Feb 2024 10:28:03 +0000 Subject: Do not crash if radio form has no name attribute --- content/handlers/html/form.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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) { -- cgit v1.2.3