diff options
Diffstat (limited to 'src/daemon/postprocessor.c')
-rw-r--r-- | src/daemon/postprocessor.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/daemon/postprocessor.c b/src/daemon/postprocessor.c index 45713ed1..241bfcdd 100644 --- a/src/daemon/postprocessor.c +++ b/src/daemon/postprocessor.c | |||
@@ -361,9 +361,10 @@ post_process_urlencoded (struct MHD_PostProcessor *pp, | |||
361 | (post_data[amper + poff] != '\n') && | 361 | (post_data[amper + poff] != '\n') && |
362 | (post_data[amper + poff] != '\r')) | 362 | (post_data[amper + poff] != '\r')) |
363 | amper++; | 363 | amper++; |
364 | end_of_value_found = ( (post_data[amper + poff] == '&') || | 364 | end_of_value_found = ( (amper + poff < post_data_len) && |
365 | (post_data[amper + poff] == '\n') || | 365 | ( (post_data[amper + poff] == '&') || |
366 | (post_data[amper + poff] == '\r') ); | 366 | (post_data[amper + poff] == '\n') || |
367 | (post_data[amper + poff] == '\r') ) ); | ||
367 | /* compute delta, the maximum number of bytes that we will be able to | 368 | /* compute delta, the maximum number of bytes that we will be able to |
368 | process right now (either amper-limited of xbuf-size limited) */ | 369 | process right now (either amper-limited of xbuf-size limited) */ |
369 | delta = amper; | 370 | delta = amper; |
@@ -417,12 +418,16 @@ post_process_urlencoded (struct MHD_PostProcessor *pp, | |||
417 | if (end_of_value_found) | 418 | if (end_of_value_found) |
418 | { | 419 | { |
419 | /* we found the end of the value! */ | 420 | /* we found the end of the value! */ |
420 | pp->state = PP_Init; | 421 | if ((post_data[poff] == '\n') || |
421 | poff++; /* skip '&' or new-lines */ | 422 | (post_data[poff] == '\r')) |
422 | 423 | { | |
423 | if ((post_data[poff - 1] == '\n') || | 424 | pp->state = PP_ExpectNewLine; |
424 | (post_data[poff - 1] == '\r')) | 425 | } |
425 | pp->state = PP_ExpectNewLine; | 426 | else |
427 | { | ||
428 | poff++; /* skip '&' */ | ||
429 | pp->state = PP_Init; | ||
430 | } | ||
426 | } | 431 | } |
427 | break; | 432 | break; |
428 | case PP_ExpectNewLine: | 433 | case PP_ExpectNewLine: |