aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2019-06-23 23:08:55 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2019-06-23 23:08:55 +0300
commit08a359c38863329518a730036cfc15c2ed35ff52 (patch)
tree6c4e8f4e679d4991e7fe3f1a47a4a22592b9195d
parent3610630cdc883dc4dca26abd24d0192825b6a978 (diff)
downloadlibmicrohttpd-08a359c38863329518a730036cfc15c2ed35ff52.tar.gz
libmicrohttpd-08a359c38863329518a730036cfc15c2ed35ff52.zip
postprocessor: fixed usage of strlen() in loop
-rw-r--r--src/microhttpd/postprocessor.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index ad0b2adf..e9d40ef7 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -520,12 +520,14 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
520 * rest of the line into the suffix ptr. 520 * rest of the line into the suffix ptr.
521 * 521 *
522 * @param prefix prefix to match 522 * @param prefix prefix to match
523 * @param prefix_len length of @a prefix
523 * @param line line to match prefix in 524 * @param line line to match prefix in
524 * @param suffix set to a copy of the rest of the line, starting at the end of the match 525 * @param suffix set to a copy of the rest of the line, starting at the end of the match
525 * @return #MHD_YES if there was a match, #MHD_NO if not 526 * @return #MHD_YES if there was a match, #MHD_NO if not
526 */ 527 */
527static int 528static int
528try_match_header (const char *prefix, 529try_match_header (const char *prefix,
530 size_t prefix_len,
529 char *line, 531 char *line,
530 char **suffix) 532 char **suffix)
531{ 533{
@@ -535,9 +537,9 @@ try_match_header (const char *prefix,
535 { 537 {
536 if (MHD_str_equal_caseless_n_ (prefix, 538 if (MHD_str_equal_caseless_n_ (prefix,
537 line, 539 line,
538 strlen (prefix))) 540 prefix_len))
539 { 541 {
540 *suffix = strdup (&line[strlen (prefix)]); 542 *suffix = strdup (&line[prefix_len]);
541 return MHD_YES; 543 return MHD_YES;
542 } 544 }
543 ++line; 545 ++line;
@@ -724,9 +726,11 @@ process_multipart_headers (struct MHD_PostProcessor *pp,
724 else 726 else
725 { 727 {
726 try_match_header ("Content-type: ", 728 try_match_header ("Content-type: ",
729 MHD_STATICSTR_LEN_("Content-type: "),
727 buf, 730 buf,
728 &pp->content_type); 731 &pp->content_type);
729 try_match_header ("Content-Transfer-Encoding: ", 732 try_match_header ("Content-Transfer-Encoding: ",
733 MHD_STATICSTR_LEN_("Content-Transfer-Encoding: "),
730 buf, 734 buf,
731 &pp->content_transfer_encoding); 735 &pp->content_transfer_encoding);
732 } 736 }