Evgeny Grin (Karlson2k) пре 1 година
родитељ
комит
e5abd45762
3 измењених фајлова са 10 додато и 8 уклоњено
  1. 3 3
      src/mhd2/mhd_str.c
  2. 2 1
      src/mhd2/stream_process_reply.c
  3. 5 4
      src/mhd2/stream_process_request.c

+ 3 - 3
src/mhd2/mhd_str.c

@@ -1422,13 +1422,13 @@ mhd_uint32_to_strx (uint_fast32_t val,
 
 #ifndef MHD_FAVOR_SMALL_CODE
 MHD_INTERNAL size_t
-mhd_uint16_to_str (uint_fast16_t val,
+mhd_uint16_to_str (uint_least16_t val,
                    char *buf,
                    size_t buf_size)
 {
   char *chr;  /**< pointer to the current printed digit */
   /* The biggest printable number is 65535 */
-  uint_fast16_t divisor = UINT16_C (10000);
+  uint_least16_t divisor = UINT16_C (10000);
   int digit;
 
   chr = buf;
@@ -1450,7 +1450,7 @@ mhd_uint16_to_str (uint_fast16_t val,
     buf_size--;
     if (1 == divisor)
       return (size_t) (chr - buf);
-    val = (uint_fast16_t) (val % divisor);
+    val = (uint_least16_t) (val % divisor);
     divisor /= 10;
     digit = (int) (val / divisor);
     mhd_assert (digit < 10);

+ 2 - 1
src/mhd2/stream_process_reply.c

@@ -34,6 +34,7 @@
 #include "sys_bool_type.h"
 #include "sys_base_types.h"
 
+#include <string.h>
 #ifdef HAVE_TIME_H
 #  include <time.h>
 #endif
@@ -829,7 +830,7 @@ build_header_response_inn (struct MHD_Connection *restrict c)
       else
       {
         mhd_assert ((! c->rp.props.send_reply_body) || \
-                    (mhd_CONN_MUST_CLOSE = c->conn_reuse));
+                    (mhd_CONN_MUST_CLOSE == c->conn_reuse));
         (void) 0;
       }
     }

+ 5 - 4
src/mhd2/stream_process_request.c

@@ -1132,7 +1132,7 @@ mhd_parse_get_args (size_t args_len,
         if (i < args_len)
           args[i] = 0;
         mhd_assert (0 == args[i]);
-        break; /* End if the parameter */
+        break; /* End of the parameter */
       }
     }
 
@@ -1143,9 +1143,10 @@ mhd_parse_get_args (size_t args_len,
       mhd_assert (name_start + 2 <= value_start);
       name_len = value_start - name_start - 2;
 
-      value_len = mhd_str_pct_decode_lenient_n (args + value_start, value_len,
-                                                args + value_start, value_len,
-                                                NULL); // TODO: add support for broken encoding detection
+      value_len =
+        mhd_str_pct_decode_lenient_n (args + value_start, i - value_len,
+                                      args + value_start, i - value_len,
+                                      NULL); // TODO: add support for broken encoding detection
       value.cstr = args + value_start;
       value.len = value_len;
     }