You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cgi_param_multiple() is broken, potentially causing endless loop in actual usage #37
Currently cgi_param_multiple() stored the "next iterator" for repeated usage.
When the last CGI parameter is match and fetched, however, we've got a value and "next iteration" is NULL;
subsequently call will redo a fetching from the start, falling into endless loop.
Activity
kennyk-peplink commentedon Jun 22, 2017
6691523
Currently cgi_param_multiple() stored the "next iterator" for repeated usage.
When the last CGI parameter is match and fetched, however, we've got a value and "next iteration" is NULL;
subsequently call will redo a fetching from the start, falling into endless loop.
kennyk-peplink commentedon Jun 22, 2017
Suggested fix: Simply store the 'iterator', not the 'next iterator'; if there is a next fetch, start from that iterator's next.
Replace "if (!iter) iter = formvars_start" with,
iter = iter ? iter->next : formvars_start;
Remove "iter = iter->next;" before break;
LeSpocky commentedon Jul 23, 2018
Personally I have currently no usecase for
cgi_param_multiple(), but I would be happy if you could provide a patch and a testcase.