libmicrohttpd2

HTTP server C library (MHD 2.x, alpha)
Log | Files | Refs | README | LICENSE

commit 1651264124e65126f3300dda0966ed5a64bbd55f
parent 76f520489e77b865eb22f9816fe184491f4065f7
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 25 Dec 2025 12:52:55 +0100

fix calls to MD_update () functions with length of 0 which is no longer allowed in MHD2

Diffstat:
Msrc/tests/client_server/libtest.c | 10+++++-----
Msrc/tests/client_server/libtest_convenience.c | 24+++++++++++++++---------
Msrc/tests/unit/unit_md5.c | 82++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/tests/unit/unit_sha256.c | 79++++++++++++++++++++++++++++++++++++++-----------------------------------------
Msrc/tests/unit/unit_sha512_256.c | 96++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/tests/unit/unit_str.c | 6+++---
6 files changed, 150 insertions(+), 147 deletions(-)

diff --git a/src/tests/client_server/libtest.c b/src/tests/client_server/libtest.c @@ -250,7 +250,7 @@ server_req_cb (void *cls, enum MHD_HTTP_Method method, uint_fast64_t upload_size) { - struct ServerContext *sc = cls; + struct ServerContext *sc = (struct ServerContext *) cls; if (NULL == sc->phase->label) return NULL; @@ -299,7 +299,7 @@ struct ClientContext static void * run_single_client (void *cls) { - struct ClientContext *cc = cls; + struct ClientContext *cc = (struct ClientContext *) cls; const char *err; fprintf (stderr, @@ -467,7 +467,7 @@ cleanup: static void * server_phase_logic (void *cls) { - struct ServerContext *ctx = cls; + struct ServerContext *ctx = (struct ServerContext *) cls; const struct MHDT_Phase *phases = ctx->phase; unsigned int j; @@ -500,7 +500,7 @@ server_phase_logic (void *cls) static void * server_run_logic (void *cls) { - struct ServerContext *ctx = cls; + struct ServerContext *ctx = (struct ServerContext *) cls; ctx->run_cb (ctx->run_cb_cls, ctx->finsig, @@ -767,7 +767,7 @@ MHDT_load_pem (const char *name) (void) close (fd); return NULL; } - buf = malloc (((size_t) s.st_size + 1)); + buf = (char *) malloc (((size_t) s.st_size + 1)); if (NULL == buf) { fprintf (stderr, diff --git a/src/tests/client_server/libtest_convenience.c b/src/tests/client_server/libtest_convenience.c @@ -88,7 +88,8 @@ const char * MHDT_server_setup_minimal (const void *cls, struct MHD_Daemon *d) { - const struct MHD_DaemonOptionAndValue *options = cls; + const struct MHD_DaemonOptionAndValue *options + = (const struct MHD_DaemonOptionAndValue *) cls; if (MHD_SC_OK != MHD_daemon_set_options ( @@ -191,7 +192,8 @@ const char * MHDT_server_setup_tls (const void *cls, struct MHD_Daemon *d) { - const struct MHD_DaemonOptionAndValue *options = cls; + const struct MHD_DaemonOptionAndValue *options + = (const struct MHD_DaemonOptionAndValue *) cls; const char *err; err = MHDT_server_setup_minimal (options, @@ -210,7 +212,8 @@ const char * MHDT_server_setup_gnutls (const void *cls, struct MHD_Daemon *d) { - const struct MHD_DaemonOptionAndValue *options = cls; + const struct MHD_DaemonOptionAndValue *options + = (const struct MHD_DaemonOptionAndValue *) cls; const char *err; err = MHDT_server_setup_minimal (options, @@ -229,7 +232,8 @@ const char * MHDT_server_setup_openssl (const void *cls, struct MHD_Daemon *d) { - const struct MHD_DaemonOptionAndValue *options = cls; + const struct MHD_DaemonOptionAndValue *options + = (const struct MHD_DaemonOptionAndValue *) cls; const char *err; err = MHDT_server_setup_minimal (options, @@ -377,6 +381,7 @@ update_fd ( { struct epoll_event ev; + (void) cls; if (watch_for == MHD_FD_STATE_NONE) { epoll_ctl (my_epoll_fd, @@ -457,8 +462,8 @@ MHDT_server_run_external (void *cls, "MHD_daemon_process_reg_events() failed\n"); break; } - timeout.tv_sec = next_wait / 1000000; - timeout.tv_usec = next_wait % 1000000; + timeout.tv_sec = (time_t) (next_wait / 1000000); + timeout.tv_usec = (suseconds_t) (next_wait % 1000000); FD_ZERO (&r); FD_SET (finsig, @@ -510,9 +515,10 @@ MHDT_server_run_external (void *cls, MHD_FD_STATE_SET_SEND (state); if (0 != (events[i].events & (EPOLLERR | EPOLLHUP)) ) MHD_FD_STATE_SET_EXCEPT (state); - MHD_daemon_event_update (d, - events[i].data.ptr, - state); + MHD_daemon_event_update ( + d, + (struct MHD_EventUpdateContext *) events[i].data.ptr, + state); } } } diff --git a/src/tests/unit/unit_md5.c b/src/tests/unit/unit_md5.c @@ -48,6 +48,7 @@ #include <stdlib.h> #include <string.h> #include <stdint.h> +#include <stdbool.h> #include "mhdt_has_param.h" @@ -122,15 +123,16 @@ bin2hex (const uint8_t *bin, } -static int +static unsigned int check_result (const char *test_name, unsigned int check_num, const uint8_t calculated[mhd_MD5_DIGEST_SIZE], const uint8_t expected[mhd_MD5_DIGEST_SIZE]) { - int failed = memcmp (calculated, - expected, - mhd_MD5_DIGEST_SIZE); + bool failed = (0 != + memcmp (calculated, + expected, + mhd_MD5_DIGEST_SIZE)); check_num++; /* Print 1-based numbers */ if (failed) @@ -238,11 +240,11 @@ static const struct data_unit1 data_units1[] = { static const size_t units1_num = sizeof(data_units1) / sizeof(data_units1[0]); /* Calculated MD5 as one pass for whole data */ -static int +static unsigned int test1_str (void) { unsigned int i; - int num_failed = 0; + unsigned int num_failed = 0; struct mhd_Md5Ctx ctx; mhd_MD5_init_one_time (&ctx); @@ -250,9 +252,10 @@ test1_str (void) { uint8_t digest[mhd_MD5_DIGEST_SIZE]; - mhd_MD5_update (&ctx, - data_units1[i].str_l.len, - (const uint8_t *) data_units1[i].str_l.str); + if (0 != data_units1[i].str_l.len) + mhd_MD5_update (&ctx, + data_units1[i].str_l.len, + (const uint8_t *) data_units1[i].str_l.str); mhd_MD5_finish_reset (&ctx, digest); if (mhd_MD5_has_err (&ctx)) @@ -418,11 +421,11 @@ static const struct data_unit2 data_units2[] = { static const size_t units2_num = sizeof(data_units2) / sizeof(data_units2[0]); -static int +static unsigned int test1_bin (void) { unsigned int i; - int num_failed = 0; + unsigned int num_failed = 0; struct mhd_Md5Ctx ctx; mhd_MD5_init_one_time (&ctx); @@ -453,11 +456,11 @@ test1_bin (void) /* Calculated MD5 as two iterations for whole data */ -static int +static unsigned int test2_str (void) { unsigned int i; - int num_failed = 0; + unsigned int num_failed = 0; struct mhd_Md5Ctx ctx; mhd_MD5_init_one_time (&ctx); @@ -466,21 +469,14 @@ test2_str (void) uint8_t digest[mhd_MD5_DIGEST_SIZE]; size_t part_s = data_units1[i].str_l.len / 4; - mhd_MD5_update (&ctx, - 0, - (const uint8_t *) ""); - mhd_MD5_update (&ctx, - part_s, - (const uint8_t *) data_units1[i].str_l.str); - mhd_MD5_update (&ctx, - 0, - (const uint8_t *) ""); - mhd_MD5_update (&ctx, - data_units1[i].str_l.len - part_s, - (const uint8_t *) data_units1[i].str_l.str + part_s); - mhd_MD5_update (&ctx, - 0, - (const uint8_t *) ""); + if (0 != part_s) + mhd_MD5_update (&ctx, + part_s, + (const uint8_t *) data_units1[i].str_l.str); + if (data_units1[i].str_l.len != part_s) + mhd_MD5_update (&ctx, + data_units1[i].str_l.len - part_s, + (const uint8_t *) data_units1[i].str_l.str + part_s); mhd_MD5_finish_reset (&ctx, digest); if (mhd_MD5_has_err (&ctx)) @@ -500,11 +496,11 @@ test2_str (void) } -static int +static unsigned int test2_bin (void) { unsigned int i; - int num_failed = 0; + unsigned int num_failed = 0; struct mhd_Md5Ctx ctx; mhd_MD5_init_one_time (&ctx); @@ -518,9 +514,6 @@ test2_bin (void) part_s, data_units2[i].bin_l.bin); mhd_MD5_update (&ctx, - 0, - (const uint8_t *) ""); - mhd_MD5_update (&ctx, data_units2[i].bin_l.len - part_s, data_units2[i].bin_l.bin + part_s); mhd_MD5_finish_reset (&ctx, @@ -546,18 +539,18 @@ test2_bin (void) #define DATA_POS 6 #define MAX_OFFSET 31 -static int +static unsigned int test_unaligned (void) { const struct data_unit2 *const tdata = data_units2 + DATA_POS; - int num_failed = 0; + unsigned int num_failed = 0; unsigned int offset; uint8_t *buf; uint8_t *digest_buf; struct mhd_Md5Ctx ctx; - buf = malloc (tdata->bin_l.len + MAX_OFFSET); - digest_buf = malloc (mhd_MD5_DIGEST_SIZE + MAX_OFFSET); + buf = (uint8_t *) malloc (tdata->bin_l.len + MAX_OFFSET); + digest_buf = (uint8_t *) malloc (mhd_MD5_DIGEST_SIZE + MAX_OFFSET); if ( (NULL == buf) || (NULL == digest_buf) ) exit (99); @@ -778,13 +771,20 @@ main (int argc, data_len = hex2bin ("616263", data, sizeof(data)); /* "abc" */ - mhd_MD5_update (&ctx, data_len, data); + mhd_MD5_update (&ctx, + data_len, + data); mhd_MD5_finish_reset (&ctx, digest); /* Second hash on same context */ - data_len = hex2bin ("616263", data, sizeof(data)); /* "abc" again */ - mhd_MD5_update (&ctx, data_len, data); - mhd_MD5_finish_deinit (&ctx, digest); + data_len = hex2bin ("616263", + data, + sizeof(data)); /* "abc" again */ + mhd_MD5_update (&ctx, + data_len, + data); + mhd_MD5_finish_deinit (&ctx, + digest); if (! mhd_MD5_has_err (&ctx)) { diff --git a/src/tests/unit/unit_sha256.c b/src/tests/unit/unit_sha256.c @@ -50,6 +50,7 @@ #include <stdlib.h> #include <string.h> #include <stdint.h> +#include <stdbool.h> #include "mhdt_has_param.h" @@ -391,13 +392,17 @@ bin2hex (const uint8_t *bin, } -static int +static unsigned int check_result (const char *test_name, unsigned int check_num, const uint8_t calculated[mhd_SHA256_DIGEST_SIZE], const uint8_t expected[mhd_SHA256_DIGEST_SIZE]) { - int failed = memcmp (calculated, expected, mhd_SHA256_DIGEST_SIZE); + bool failed = (0 != + memcmp (calculated, + expected, + mhd_SHA256_DIGEST_SIZE)); + check_num++; /* Print 1-based numbers */ if (failed) { @@ -409,8 +414,9 @@ check_result (const char *test_name, "FAILED: %s check %u: calculated digest %s, expected digest %s.\n", test_name, check_num, calc_str, expc_str); fflush (stderr); + return 1; } - else if (verbose) + if (verbose) { char calc_str[SHA256_DIGEST_STRING_SIZE]; bin2hex (calculated, mhd_SHA256_DIGEST_SIZE, calc_str); @@ -419,7 +425,7 @@ check_result (const char *test_name, test_name, check_num, calc_str); fflush (stdout); } - return failed ? 1 : 0; + return 0; } @@ -428,10 +434,10 @@ check_result (const char *test_name, */ /* Calculated SHA-256 as one pass for whole data */ -static int +static unsigned int test1_str (void) { - int num_failed = 0; + unsigned int num_failed = 0; unsigned int i; struct mhd_Sha256Ctx ctx; @@ -440,9 +446,10 @@ test1_str (void) { uint8_t digest[mhd_SHA256_DIGEST_SIZE]; - mhd_SHA256_update (&ctx, - data_units1[i].str_l.len, - (const uint8_t *) data_units1[i].str_l.str); + if (0 != data_units1[i].str_l.len) + mhd_SHA256_update (&ctx, + data_units1[i].str_l.len, + (const uint8_t *) data_units1[i].str_l.str); mhd_SHA256_finish_reset (&ctx, digest); #ifdef MHD_SHA256_HAS_EXT_ERROR @@ -460,10 +467,10 @@ test1_str (void) } -static int +static unsigned int test1_bin (void) { - int num_failed = 0; + unsigned int num_failed = 0; unsigned int i; struct mhd_Sha256Ctx ctx; @@ -494,10 +501,10 @@ test1_bin (void) /* Calculated SHA-256 as two iterations for whole data */ -static int +static unsigned int test2_str (void) { - int num_failed = 0; + unsigned int num_failed = 0; unsigned int i; struct mhd_Sha256Ctx ctx; @@ -507,21 +514,14 @@ test2_str (void) uint8_t digest[mhd_SHA256_DIGEST_SIZE]; size_t part_s = data_units1[i].str_l.len / 4; - mhd_SHA256_update (&ctx, - 0, - (const uint8_t *) ""); - mhd_SHA256_update (&ctx, - part_s, - (const uint8_t *) data_units1[i].str_l.str); - mhd_SHA256_update (&ctx, - 0, - (const uint8_t *) ""); - mhd_SHA256_update (&ctx, - data_units1[i].str_l.len - part_s, - (const uint8_t *) data_units1[i].str_l.str + part_s); - mhd_SHA256_update (&ctx, - 0, - (const uint8_t *) ""); + if (0 != part_s) + mhd_SHA256_update (&ctx, + part_s, + (const uint8_t *) data_units1[i].str_l.str); + if (data_units1[i].str_l.len != part_s) + mhd_SHA256_update (&ctx, + data_units1[i].str_l.len - part_s, + (const uint8_t *) data_units1[i].str_l.str + part_s); mhd_SHA256_finish_reset (&ctx, digest); #ifdef MHD_SHA256_HAS_EXT_ERROR if (0 != ctx.ext_error) @@ -538,10 +538,10 @@ test2_str (void) } -static int +static unsigned int test2_bin (void) { - int num_failed = 0; + unsigned int num_failed = 0; unsigned int i; struct mhd_Sha256Ctx ctx; @@ -555,9 +555,6 @@ test2_bin (void) part_s, data_units2[i].bin_l.bin); mhd_SHA256_update (&ctx, - 0, - (const uint8_t *) ""); - mhd_SHA256_update (&ctx, data_units2[i].bin_l.len - part_s, data_units2[i].bin_l.bin + part_s); mhd_SHA256_finish_reset (&ctx, @@ -583,10 +580,10 @@ test2_bin (void) #define DATA_POS 6 #define MAX_OFFSET 31 -static int +static unsigned int test_unaligned (void) { - int num_failed = 0; + unsigned int num_failed = 0; unsigned int offset; uint8_t *buf; uint8_t *digest_buf; @@ -595,8 +592,8 @@ test_unaligned (void) const struct data_unit2 *const tdata = data_units2 + DATA_POS; mhd_SHA256_init_one_time (&ctx); - buf = malloc (tdata->bin_l.len + MAX_OFFSET); - digest_buf = malloc (mhd_SHA256_DIGEST_SIZE + MAX_OFFSET); + buf = (uint8_t *) malloc (tdata->bin_l.len + MAX_OFFSET); + digest_buf = (uint8_t *) malloc (mhd_SHA256_DIGEST_SIZE + MAX_OFFSET); if ((NULL == buf) || (NULL == digest_buf)) exit (99); @@ -684,9 +681,9 @@ main (int argc, uint8_t digest[mhd_SHA256_DIGEST_SIZE]; uint8_t data[1024]; size_t data_len; - int passed = 0; - int total = 0; - int num_failed; + unsigned int passed = 0; + unsigned int total = 0; + unsigned int num_failed; if (mhdt_has_param (argc, argv, "-v") || mhdt_has_param (argc, argv, "--verbose")) @@ -744,7 +741,7 @@ main (int argc, if ((0 != num_failed) || verbose) fprintf (stderr, - "Result: %d tests failed\n", + "Result: %u tests failed\n", num_failed); return (0 == num_failed) ? 0 : 1; diff --git a/src/tests/unit/unit_sha512_256.c b/src/tests/unit/unit_sha512_256.c @@ -51,6 +51,7 @@ #include <stdlib.h> #include <string.h> #include <stdint.h> +#include <stdbool.h> #include "mhdt_has_param.h" @@ -91,7 +92,7 @@ hex2bin (const char *hex, /* Helper function to compare digest with expected hex string */ -static int +static unsigned int check_digest (const uint8_t *digest, size_t digest_len, const char *expected_hex, @@ -499,13 +500,16 @@ bin2hex (const uint8_t *bin, } -static int +static unsigned int check_result (const char *test_name, unsigned int check_num, const uint8_t calculated[mhd_SHA512_256_DIGEST_SIZE], const uint8_t expected[mhd_SHA512_256_DIGEST_SIZE]) { - int failed = memcmp (calculated, expected, mhd_SHA512_256_DIGEST_SIZE); + bool failed = (0 != memcmp (calculated, + expected, + mhd_SHA512_256_DIGEST_SIZE)); + check_num++; /* Print 1-based numbers */ if (failed) { @@ -517,8 +521,9 @@ check_result (const char *test_name, "FAILED: %s check %u: calculated digest %s, expected digest %s.\n", test_name, check_num, calc_str, expc_str); fflush (stderr); + return 1; } - else if (verbose) + if (verbose) { char calc_str[mhd_SHA512_256_DIGEST_SIZE * 2 + 1]; bin2hex (calculated, mhd_SHA512_256_DIGEST_SIZE, calc_str); @@ -527,7 +532,7 @@ check_result (const char *test_name, test_name, check_num, calc_str); fflush (stdout); } - return failed ? 1 : 0; + return 0; } @@ -536,10 +541,10 @@ check_result (const char *test_name, */ /* Calculated SHA-512/256 as one pass for whole data */ -static int +static unsigned int test1_str (void) { - int num_failed = 0; + unsigned int num_failed = 0; unsigned int i; struct mhd_Sha512_256Ctx ctx; @@ -548,12 +553,13 @@ test1_str (void) uint8_t digest[mhd_SHA512_256_DIGEST_SIZE]; mhd_SHA512_256_init_one_time (&ctx); - mhd_SHA512_256_update (&ctx, - data_units1[i].str_l.len, - (const uint8_t *) data_units1[i].str_l.str); + if (0 != data_units1[i].str_l.len) + mhd_SHA512_256_update (&ctx, + data_units1[i].str_l.len, + (const uint8_t *) data_units1[i].str_l.str); mhd_SHA512_256_finish_reset (&ctx, digest); - num_failed += check_result (__FUNCTION__, + num_failed += check_result (MHD_FUNC_, i, digest, data_units1[i].digest); @@ -563,10 +569,10 @@ test1_str (void) } -static int +static unsigned int test1_bin (void) { - int num_failed = 0; + unsigned int num_failed = 0; unsigned int i; struct mhd_Sha512_256Ctx ctx; @@ -580,7 +586,7 @@ test1_bin (void) data_units2[i].bin_l.bin); mhd_SHA512_256_finish_reset (&ctx, digest); - num_failed += check_result (__FUNCTION__, + num_failed += check_result (MHD_FUNC_, i, digest, data_units2[i].digest); @@ -591,10 +597,10 @@ test1_bin (void) /* Calculated SHA-512/256 as two iterations for whole data */ -static int +static unsigned int test2_str (void) { - int num_failed = 0; + unsigned int num_failed = 0; unsigned int i; struct mhd_Sha512_256Ctx ctx; @@ -604,24 +610,18 @@ test2_str (void) size_t part_s = data_units1[i].str_l.len / 4; mhd_SHA512_256_init_one_time (&ctx); - mhd_SHA512_256_update (&ctx, - 0, - (const uint8_t *) ""); - mhd_SHA512_256_update (&ctx, - part_s, - (const uint8_t *) data_units1[i].str_l.str); - mhd_SHA512_256_update (&ctx, - 0, - (const uint8_t *) ""); - mhd_SHA512_256_update (&ctx, - data_units1[i].str_l.len - part_s, - (const uint8_t *) data_units1[i].str_l.str + part_s); - mhd_SHA512_256_update (&ctx, - 0, - (const uint8_t *) ""); + if (0 != part_s) + mhd_SHA512_256_update (&ctx, + part_s, + (const uint8_t *) data_units1[i].str_l.str); + if (data_units1[i].str_l.len != part_s) + mhd_SHA512_256_update (&ctx, + data_units1[i].str_l.len - part_s, + (const uint8_t *) data_units1[i].str_l.str + part_s + ); mhd_SHA512_256_finish_reset (&ctx, digest); - num_failed += check_result (__FUNCTION__, + num_failed += check_result (MHD_FUNC_, i, digest, data_units1[i].digest); @@ -631,10 +631,10 @@ test2_str (void) } -static int +static unsigned int test2_bin (void) { - int num_failed = 0; + unsigned int num_failed = 0; unsigned int i; struct mhd_Sha512_256Ctx ctx; @@ -648,14 +648,11 @@ test2_bin (void) part_s, data_units2[i].bin_l.bin); mhd_SHA512_256_update (&ctx, - 0, - (const uint8_t *) ""); - mhd_SHA512_256_update (&ctx, data_units2[i].bin_l.len - part_s, data_units2[i].bin_l.bin + part_s); mhd_SHA512_256_finish_reset (&ctx, digest); - num_failed += check_result (__FUNCTION__, + num_failed += check_result (MHD_FUNC_, i, digest, data_units2[i].digest); @@ -669,18 +666,18 @@ test2_bin (void) #define DATA_POS 6 #define MAX_OFFSET 63 -static int +static unsigned int test_unaligned (void) { - int num_failed = 0; + unsigned int num_failed = 0; unsigned int offset; uint8_t *buf; uint8_t *digest_buf; struct mhd_Sha512_256Ctx ctx; const struct data_unit2 *const tdata = data_units2 + DATA_POS; - buf = malloc (tdata->bin_l.len + MAX_OFFSET); - digest_buf = malloc (mhd_SHA512_256_DIGEST_SIZE + MAX_OFFSET); + buf = (uint8_t *) malloc (tdata->bin_l.len + MAX_OFFSET); + digest_buf = (uint8_t *) malloc (mhd_SHA512_256_DIGEST_SIZE + MAX_OFFSET); if ((NULL == buf) || (NULL == digest_buf)) exit (99); @@ -690,17 +687,20 @@ test_unaligned (void) uint8_t *unaligned_buf; unaligned_buf = buf + offset; - memcpy (unaligned_buf, tdata->bin_l.bin, tdata->bin_l.len); + memcpy (unaligned_buf, + tdata->bin_l.bin, + tdata->bin_l.len); unaligned_digest = digest_buf + MAX_OFFSET - offset; - memset (unaligned_digest, 0, mhd_SHA512_256_DIGEST_SIZE); - + memset (unaligned_digest, + 0, + mhd_SHA512_256_DIGEST_SIZE); mhd_SHA512_256_init_one_time (&ctx); mhd_SHA512_256_update (&ctx, tdata->bin_l.len, unaligned_buf); mhd_SHA512_256_finish_reset (&ctx, unaligned_digest); - num_failed += check_result (__FUNCTION__, + num_failed += check_result (MHD_FUNC_, MAX_OFFSET - offset, unaligned_digest, tdata->digest); @@ -760,7 +760,7 @@ main (int argc, size_t data_len; unsigned int passed = 0; unsigned int total = 0; - int num_failed; + unsigned int num_failed; if (mhdt_has_param (argc, argv, "-v") || mhdt_has_param (argc, argv, "--verbose")) @@ -818,7 +818,7 @@ main (int argc, if ((0 != num_failed) || verbose) fprintf (stderr, - "Result: %d tests failed\n", + "Result: %u tests failed\n", num_failed); return (0 == num_failed) ? 0 : 1; diff --git a/src/tests/unit/unit_str.c b/src/tests/unit/unit_str.c @@ -119,9 +119,9 @@ main (int argc, MHDT_EXPECT_TRUE (mhd_str_equal_lowercase_bin_n ("AB", "ab", 2)); - MHDT_EXPECT_FALSE (mhd_str_equal_lowercase_bin_n ("ab", - "AB", - 2)); + MHDT_EXPECT_TRUE (mhd_str_equal_lowercase_bin_n ("aB", + "ab", + 2)); MHDT_EXPECT_TRUE (mhd_str_is_lowercase_bin_n (0, "")); MHDT_EXPECT_TRUE (mhd_str_is_lowercase_bin_n (2,