summaryrefslogtreecommitdiff
path: root/sys/src/cmd/mothra/forms.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@rei2.9hal>2011-10-24 20:39:15 +0200
committercinap_lenrek <cinap_lenrek@rei2.9hal>2011-10-24 20:39:15 +0200
commitf1b873ba6e3f97be85816dba8075d4d97ae0cc2f (patch)
tree08eb23f96cdefef0bdea38b4637a555b35e91dbe /sys/src/cmd/mothra/forms.c
parent1c31521e2d4a0026c406a536efcb78d4660c9ebe (diff)
mothra: ignore form inputs without a name on submit
Diffstat (limited to 'sys/src/cmd/mothra/forms.c')
-rw-r--r--sys/src/cmd/mothra/forms.c20
1 files 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);