Fossil SCM

Make cgi_all() check every argument, not only the first, and end the argument list of its caller on /setup_uedit with a null pointer, so that a POST holding only a login no longer creates a user.

dmestas 2026-11-21 10:40 UTC small-fixes
Commit 8313916950351d329c6e8e80a0a0b7bce2041f7f824c5a44304ba179e4a777c9
2 files changed +1 -1 +1 -1
+1 -1
--- src/cgi.c
+++ src/cgi.c
@@ -1851,11 +1851,11 @@
18511851
int cgi_all(const char *z, ...){
18521852
va_list ap;
18531853
char *z2;
18541854
if( cgi_parameter(z,0)==0 ) return 0;
18551855
va_start(ap, z);
1856
- while( (z2 = va_arg(ap, char*))==0 ){
1856
+ while( (z2 = va_arg(ap, char*))!=0 ){
18571857
if( cgi_parameter(z2,0)==0 ) return 0;
18581858
}
18591859
va_end(ap);
18601860
return 1;
18611861
}
18621862
--- src/cgi.c
+++ src/cgi.c
@@ -1851,11 +1851,11 @@
1851 int cgi_all(const char *z, ...){
1852 va_list ap;
1853 char *z2;
1854 if( cgi_parameter(z,0)==0 ) return 0;
1855 va_start(ap, z);
1856 while( (z2 = va_arg(ap, char*))==0 ){
1857 if( cgi_parameter(z2,0)==0 ) return 0;
1858 }
1859 va_end(ap);
1860 return 1;
1861 }
1862
--- src/cgi.c
+++ src/cgi.c
@@ -1851,11 +1851,11 @@
1851 int cgi_all(const char *z, ...){
1852 va_list ap;
1853 char *z2;
1854 if( cgi_parameter(z,0)==0 ) return 0;
1855 va_start(ap, z);
1856 while( (z2 = va_arg(ap, char*))!=0 ){
1857 if( cgi_parameter(z2,0)==0 ) return 0;
1858 }
1859 va_end(ap);
1860 return 1;
1861 }
1862
+1 -1
--- src/setupuser.c
+++ src/setupuser.c
@@ -518,11 +518,11 @@
518518
519519
/* If we have all the necessary information, write the new or
520520
** modified user record. After writing the user record, redirect
521521
** to the page that displays a list of users.
522522
*/
523
- if( !cgi_all("login","info","pw","apply") ){
523
+ if( !cgi_all("login","info","pw","apply",(char*)0) ){
524524
/* need all of the above properties to make a change. Since one or
525525
** more are missing, no-op */
526526
}else if( higherUser ){
527527
/* An Admin (a) user cannot edit a Superuser (s) */
528528
}else if( zDeleteVerify!=0 ){
529529
--- src/setupuser.c
+++ src/setupuser.c
@@ -518,11 +518,11 @@
518
519 /* If we have all the necessary information, write the new or
520 ** modified user record. After writing the user record, redirect
521 ** to the page that displays a list of users.
522 */
523 if( !cgi_all("login","info","pw","apply") ){
524 /* need all of the above properties to make a change. Since one or
525 ** more are missing, no-op */
526 }else if( higherUser ){
527 /* An Admin (a) user cannot edit a Superuser (s) */
528 }else if( zDeleteVerify!=0 ){
529
--- src/setupuser.c
+++ src/setupuser.c
@@ -518,11 +518,11 @@
518
519 /* If we have all the necessary information, write the new or
520 ** modified user record. After writing the user record, redirect
521 ** to the page that displays a list of users.
522 */
523 if( !cgi_all("login","info","pw","apply",(char*)0) ){
524 /* need all of the above properties to make a change. Since one or
525 ** more are missing, no-op */
526 }else if( higherUser ){
527 /* An Admin (a) user cannot edit a Superuser (s) */
528 }else if( zDeleteVerify!=0 ){
529

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button