From f1b873ba6e3f97be85816dba8075d4d97ae0cc2f Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 24 Oct 2011 20:39:15 +0200 Subject: [PATCH] mothra: ignore form inputs without a name on submit --- sys/src/cmd/mothra/forms.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sys/src/cmd/mothra/forms.c b/sys/src/cmd/mothra/forms.c index 9ce604efb..1ad04d2a0 100644 --- a/sys/src/cmd/mothra/forms.c +++ b/sys/src/cmd/mothra/forms.c @@ -549,6 +549,8 @@ void h_submitinput(Panel *p, int){ for(f=form->fields;f;f=f->next) switch(f->type){ case TYPEIN: case PASSWD: + if(f->name==0) + continue; size+=ulen(f->name)+1+ulen(plentryval(f->p))+1; break; case INDEX: @@ -558,14 +560,20 @@ void h_submitinput(Panel *p, int){ case RADIO: if(!f->state) break; case HIDDEN: + if(f->name==0 || f->value==0) + continue; size+=ulen(f->name)+1+ulen(f->value)+1; break; case SELECT: + if(f->name==0) + continue; for(o=f->options;o;o=o->next) - if(o->selected) + if(o->selected && o->value) size+=ulen(f->name)+1+ulen(o->value)+1; break; case TEXTWIN: + if(f->name==0) + continue; size+=ulen(f->name)+1+plelen(f->textwin)*3+1; break; } @@ -583,6 +591,8 @@ void h_submitinput(Panel *p, int){ for(f=form->fields;f;f=f->next) switch(f->type){ case TYPEIN: case PASSWD: + if(f->name==0) + continue; if(sep) *bufp++=sep; sep='&'; bufp=ucpy(bufp, f->name); @@ -598,6 +608,8 @@ void h_submitinput(Panel *p, int){ case RADIO: if(!f->state) break; case HIDDEN: + if(f->name==0 || f->value==0) + continue; if(sep) *bufp++=sep; sep='&'; bufp=ucpy(bufp, f->name); @@ -605,8 +617,10 @@ void h_submitinput(Panel *p, int){ bufp=ucpy(bufp, f->value); break; case SELECT: + if(f->name==0) + continue; for(o=f->options;o;o=o->next) - if(o->selected){ + if(o->selected && o->value){ if(sep) *bufp++=sep; sep='&'; bufp=ucpy(bufp, f->name); @@ -615,6 +629,8 @@ void h_submitinput(Panel *p, int){ } break; case TEXTWIN: + if(f->name==0) + continue; if(sep) *bufp++=sep; sep='&'; bufp=ucpy(bufp, f->name);